SOAP::DateTime - Support for converting dates to C<xsd:dateTime> format


SOAP-DateTime documentation Contained in the SOAP-DateTime distribution.

Index


Code Index:

NAME

Top

SOAP::DateTime - Support for converting dates to xsd:dateTime format

SYNOPSIS

Top

  use SOAP::DateTime;
  my $soap_datetime = ConvertDate($arbitrary_date);

DESCRIPTION

Top

SOAP::DateTime converts dates into the format required by the xsd:dateTime type.

USAGE

Top

See the synopsis for an example. Date parsing is handled with Date::Manip, so the date format used as input is ridiculously flexible.

BUGS

Top

None known.

SUPPORT

Top

Contact the author for support.

AUTHOR

Top

	Joe McMahon
	CPAN ID: MCMAHON
	mcmahon@ibiblio.org
	http://a.galaxy.far.far.away/modules

COPYRIGHT

Top

SEE ALSO

Top

perl(1), Date::Manip(1).

ConvertDate($date)

Accepts the date (in any Date::Manip-supported format) and returns a date in the format YYYY-MM-DDTHH:MM:SS; so, for example, December 14 1984 12:14:37 would be 1984-12-14T12:14:37.


SOAP-DateTime documentation Contained in the SOAP-DateTime distribution.

package SOAP::DateTime;
use strict;
use Date::Manip;

BEGIN {
	use Exporter ();
	use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
	$VERSION     = 0.02;
	@ISA         = qw (Exporter);
	#Give a hoot don't pollute, do not export more than needed by default
	@EXPORT      = qw (ConvertDate);
	@EXPORT_OK   = qw ();
	%EXPORT_TAGS = ();
}


sub ConvertDate {
  my $date = shift;
  die "No date supplied\n" unless $date;
  my $parsed = ParseDate($date);
  die "Unparseable date\n" unless $parsed;
  UnixDate($parsed,"%Y-%m-%dT%H:%M:%S");
}

1; #this line is important and will help the module return a true value
__END__