@node Date/Format, Date/Manip, Date/DateCalc, Module List
@unnumbered Date formating subroutines


@unnumberedsec NAME

Date::Format - Date formating subroutines

@unnumberedsec SYNOPSIS

@example
use Date::Format;

@@lt = timelocal(time);

print time2str($template, time);
print strftime($template, @@lt);

print time2str($template, time, $zone);
print strftime($template, @@lt, $zone);

print ctime(time);
print ascctime(@@lt);

print ctime(time, $zone);
print asctime(@@lt, $zone);
@end example

@unnumberedsec DESCRIPTION

This module provides routines to format dates into ASCII strings. They
correspond to the C library routines strftime and ctime.

@table @asis
@item time2str(TEMPLATE, TIME [, ZONE])
@code{time2str} converts TIME into an ASCII string using the conversion
specification given in @code{TEMPLATE}. @code{ZONE} if given specifies the zone
which the output is required to be in, @code{ZONE} defaults to your current zone.

@item strftime(TEMPLATE, TIME [, ZONE])
strftime is similar to @code{time2str} with the exception that the time is
passed as an array, such as the array returned by localtime.

@item ctime(TIME [, ZONE])
ctime calls @code{time2str} with the given arguments using the
conversion specification @code{"%a %b %e %T %Y\n"}

@item asctime(TIME [, ZONE])
asctime calls @code{time2str} with the given arguments using the
conversion specification @code{"%a %b %e %T %Y\n"}

@end table
@unnumberedsec MULTI-LANGUAGE SUPPORT

Date::Format is capable of formating into several languages, these are
English, French, German and Italian. Changing the language is done via
a static method call, for example

@example
Date::Format->language(@'German@');
@end example

will change the language in which all subsequent dates are formatted.

This is only a first pass, I am considering changing this to be

@example
$lang = Date::Language->new(@'German@');
$lang->time2str("%a %b %e %T %Y\n", time);
@end example

I am open to suggestions on this.

@unnumberedsec CONVERSION SPECIFICATION

Each conversion specification  is  replaced  by  appropriate
characters   as   described  in  the  following  list.   The
appropriate  characters  are  determined  by   the   LC_TIME
category of the program@'s locale.

@example
%%	PERCENT
%a	day of the week abbr
%A	day of the week
%b	month abbr
%B 	month
%c 	ctime format: Sat Nov 19 21:05:57 1994
%d 	numeric day of the month
%e 	DD
%D 	MM/DD/YY
%h 	month abbr
%H 	hour, 24 hour clock, leading 0@'s)
%I 	hour, 12 hour clock, leading 0@'s)
%j 	day of the year
%k 	hour
%l 	hour, 12 hour clock
%m 	month number, starting with 1
%M 	minute, leading 0@'s
%n 	NEWLINE
%o	ornate day of month -- "1st", "2nd", "25th", etc.
%p 	AM or PM 
%r 	time format: 09:05:57 PM
%R 	time format: 21:05
%s	seconds since the Epoch, UCT
%S 	seconds, leading 0@'s
%t 	TAB
%T 	time format: 21:05:57
%U 	week number, Sunday as first day of week
%w 	day of the week, numerically, Sunday == 0
%W 	week number, Monday as first day of week
%x 	date format: 11/19/94
%X 	time format: 21:05:57
%y	year (2 digits)
%Y	year (4 digits)
%Z 	timezone in ascii. eg: PST
%z	timezone in format -/+0000
@end example

@unnumberedsec AUTHOR

Graham Barr <Graham.Barr@@tiuk.ti.com>

@unnumberedsec REVISION

$Revision: 2.6 $

@unnumberedsec COPYRIGHT

Copyright (c) 1995 Graham Barr. All rights reserved. This program is free
software; you can redistribute it and/or modify it under the same terms
as Perl itself.

