ePages 6.10 - DE_EPAGES/XML/API/DateTimeFormatXML.pm

Package DE_EPAGES::XML::API::DateTimeFormatXML

Implements a DateTime parser for Sybase ASE as extension for DateTime::Format::DBI.
Example format string: Dec 1 2003 12:52PM.

Functions

format_datetime
new
parse_datetime

format_datetime

Formats a DateTime object to a string that is ISO8601 using the format pattern YYYY-MM-DDThh:mm:ss(Z|[+-]hh:mm). If the DateTime object is 'floating', the local server time zone is assumed. If a special time zone passed, force recalculation to this. Therefore it is best to set the time zone information before calling this function.

Syntax
$String = $Parser->format_datetime( $DateTime );
$String = $Parser->format_datetime( $DateTime, 'Europe/Berlin' );
$String = $Parser->format_datetime( $DateTime, LoadRootObject()->get('TimeZone') );
Input
$DateTime (object)
a DateTime object
$TimeZone (string (optional))
time zone
Return
$String (string)
string containing date, time and time zone

new

Creates a date and time formatter for the default Sybase ASE datetime format.

Syntax
$Parser = DE_EPAGES::XML::API::DateTimeFormatXML->new;
Example
my $Parser = DE_EPAGES::XML::API::DateTimeFormatXML->new;
my $DateTime = $Parser->parse_datetime( 'Dec  1 2003 12:52PM' );
print $Parser->format_datetime( $DateTime );
Return
$Parser (object)
parser/formatter object

parse_datetime

Parses a date/time format string according to ISO8601, for example: YYYY-MM-DDThh:mm:ss(Z|[+-]hh:mm). If the time has no time zone specified, then the time is converted to a passed time zone (if defined). If then the time has a time zone specification, the time is converted to the server time zone, otherwise the DateTime object remains 'floating'.

Syntax
$DateTime = $Parser->parse_datetime( $String );
Input
$String (string)
string containing date, time and timezone(optional)
$TimeZone (string (optional))
time zone
Return
$DateTime (object)
a DateTime object