+ my $formatter = DateTime::Locale->load($lang);
+ return $self->loc("DateTime::Locale doesn't support date_format_full, you must upgrade to use this feature")
+ unless $formatter->can('date_format_full');
+ $date_format = $formatter->$date_format;
+ $time_format = $formatter->$time_format;
+ $date_format =~ s/EEEE/EEE/g if ( $args{'AbbrDay'} );
+ $date_format =~ s/MMMM/MMM/g if ( $args{'AbbrMonth'} );
+
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydaym,$isdst,$offset) =
+ $self->Localtime($args{'Timezone'});
+ $mon++;
+ my $tz = $self->Timezone($args{'Timezone'});
+
+ # FIXME : another way to call this module without conflict with local
+ # DateTime method?
+ my $dt = new DateTime::( locale => $lang,
+ time_zone => $tz,
+ year => $year,
+ month => $mon,
+ day => $mday,
+ hour => $hour,
+ minute => $min,
+ second => $sec,
+ nanosecond => 0,
+ );
+
+ if ( $args{'Date'} && !$args{'Time'} ) {
+ return $dt->format_cldr($date_format);
+ } elsif ( !$args{'Date'} && $args{'Time'} ) {
+ return $dt->format_cldr($time_format);
+ } else {
+ return $dt->format_cldr($date_format) . " " . $dt->format_cldr($time_format);
+ }
+}
+
+=head3 ISO
+
+Returns the object's date in ISO format C<YYYY-MM-DD mm:hh:ss>.
+ISO format is locale independant, but adding timezone offset info
+is not implemented yet.
+
+Supports arguments: C<Timezone>, C<Date>, C<Time> and C<Seconds>.
+See </Output formatters> for description of arguments.
+
+=cut
+
+sub ISO {
+ my $self = shift;
+ my %args = ( Date => 1,
+ Time => 1,
+ Timezone => '',
+ Seconds => 1,
+ @_,
+ );
+ # 0 1 2 3 4 5 6 7 8 9
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydaym,$isdst,$offset) =
+ $self->Localtime($args{'Timezone'});
+
+ #the month needs incrementing, as gmtime returns 0-11
+ $mon++;
+
+ my $res = '';
+ $res .= sprintf("%04d-%02d-%02d", $year, $mon, $mday) if $args{'Date'};
+ $res .= sprintf(' %02d:%02d', $hour, $min) if $args{'Time'};
+ $res .= sprintf(':%02d', $sec, $min) if $args{'Time'} && $args{'Seconds'};
+ $res =~ s/^\s+//;
+
+ return $res;
+}
+
+=head3 W3CDTF
+
+Returns the object's date and time in W3C date time format
+(L<http://www.w3.org/TR/NOTE-datetime>).
+
+Format is locale independand and is close enought to ISO, but
+note that date part is B<not optional> and output string
+has timezone offset mark in C<[+-]hh:mm> format.
+
+Supports arguments: C<Timezone>, C<Time> and C<Seconds>.
+See </Output formatters> for description of arguments.
+
+=cut
+
+sub W3CDTF {
+ my $self = shift;
+ my %args = (
+ Time => 1,
+ Timezone => '',
+ Seconds => 1,
+ @_,
+ Date => 1,
+ );
+ # 0 1 2 3 4 5 6 7 8 9
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydaym,$isdst,$offset) =
+ $self->Localtime( $args{'Timezone'} );
+
+ #the month needs incrementing, as gmtime returns 0-11
+ $mon++;
+
+ my $res = '';
+ $res .= sprintf("%04d-%02d-%02d", $year, $mon, $mday);
+ if ( $args{'Time'} ) {
+ $res .= sprintf('T%02d:%02d', $hour, $min);
+ $res .= sprintf(':%02d', $sec, $min) if $args{'Seconds'};
+ if ( $offset ) {
+ $res .= sprintf "%s%02d:%02d", $self->_SplitOffset( $offset );
+ } else {
+ $res .= 'Z';
+ }
+ }
+
+ return $res;
+};
+
+
+=head3 RFC2822 (MIME)
+
+Returns the object's date and time in RFC2822 format,
+for example C<Sun, 06 Nov 1994 08:49:37 +0000>.
+Format is locale independand as required by RFC. Time
+part always has timezone offset in digits with sign prefix.
+
+Supports arguments: C<Timezone>, C<Date>, C<Time>, C<DayOfWeek>
+and C<Seconds>. See </Output formatters> for description of
+arguments.
+
+=cut
+
+sub RFC2822 {
+ my $self = shift;
+ my %args = ( Date => 1,
+ Time => 1,
+ Timezone => '',
+ DayOfWeek => 1,
+ Seconds => 1,
+ @_,
+ );
+
+ # 0 1 2 3 4 5 6 7 8 9
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydaym,$isdst,$offset) =
+ $self->Localtime($args{'Timezone'});
+
+ my ($date, $time) = ('','');
+ $date .= "$DAYS_OF_WEEK[$wday], " if $args{'DayOfWeek'} && $args{'Date'};
+ $date .= "$mday $MONTHS[$mon] $year" if $args{'Date'};
+
+ if ( $args{'Time'} ) {
+ $time .= sprintf("%02d:%02d", $hour, $min);
+ $time .= sprintf(":%02d", $sec) if $args{'Seconds'};
+ $time .= sprintf " %s%02d%02d", $self->_SplitOffset( $offset );
+ }
+
+ return join ' ', grep $_, ($date, $time);
+}
+
+=head3 RFC2616 (HTTP)
+
+Returns the object's date and time in RFC2616 (HTTP/1.1) format,
+for example C<Sun, 06 Nov 1994 08:49:37 GMT>. While the RFC describes
+version 1.1 of HTTP, but the same form date can be used in version 1.0.
+
+Format is fixed length, locale independand and always represented in GMT
+what makes it quite useless for users, but any date in HTTP transfers
+must be presented using this format.
+
+ HTTP-date = rfc1123 | ...
+ rfc1123 = wkday "," SP date SP time SP "GMT"
+ date = 2DIGIT SP month SP 4DIGIT
+ ; day month year (e.g., 02 Jun 1982)
+ time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
+ ; 00:00:00 - 23:59:59
+ wkday = "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"
+ month = "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun"
+ | "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"
+
+Supports arguments: C<Date> and C<Time>, but you should use them only for
+some personal reasons, RFC2616 doesn't define any optional parts.
+See </Output formatters> for description of arguments.
+
+=cut
+
+sub RFC2616 {
+ my $self = shift;
+ my %args = ( Date => 1, Time => 1,
+ @_,
+ Timezone => 'utc',
+ Seconds => 1, DayOfWeek => 1,
+ );
+
+ my $res = $self->RFC2822( @_ );
+ $res =~ s/\s*[+-]\d\d\d\d$/ GMT/ if $args{'Time'};
+ return $res;
+}
+
+=head4 iCal
+
+Returns the object's date and time in iCalendar format,
+
+Supports arguments: C<Date> and C<Time>.
+See </Output formatters> for description of arguments.
+
+=cut
+
+sub iCal {
+ my $self = shift;
+ my %args = (
+ Date => 1, Time => 1,
+ @_,
+ );
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydaym,$isdst,$offset) =
+ $self->Localtime( 'utc' );