home *** CD-ROM | disk | FTP | other *** search
Wrap
<HTML> <HEAD> <TITLE>Date::Format - Date formating subroutines</TITLE> <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css"> <LINK REV="made" HREF="mailto:"> </HEAD> <BODY> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%> <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc"> <STRONG><P CLASS=block> Date::Format - Date formating subroutines</P></STRONG> </TD></TR> </TABLE> <A NAME="__index__"></A> <!-- INDEX BEGIN --> <UL> <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI> <LI><A HREF="#synopsis">SYNOPSIS</A></LI> <LI><A HREF="#description">DESCRIPTION</A></LI> <LI><A HREF="#multilanguage support">MULTI-LANGUAGE SUPPORT</A></LI> <LI><A HREF="#conversion specification">CONVERSION SPECIFICATION</A></LI> <LI><A HREF="#author">AUTHOR</A></LI> <LI><A HREF="#copyright">COPYRIGHT</A></LI> </UL> <!-- INDEX END --> <HR> <P> <H1><A NAME="name">NAME</A></H1> <P>Date::Format - Date formating subroutines</P> <P> <HR> <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1> <UL> <LI>Linux</LI> <LI>Solaris</LI> <LI>Windows</LI> </UL> <HR> <H1><A NAME="synopsis">SYNOPSIS</A></H1> <PRE> use Date::Format; </PRE> <PRE> @lt = timelocal(time);</PRE> <PRE> print time2str($template, time); print strftime($template, @lt);</PRE> <PRE> print time2str($template, time, $zone); print strftime($template, @lt, $zone);</PRE> <PRE> print ctime(time); print ascctime(@lt);</PRE> <PRE> print ctime(time, $zone); print asctime(@lt, $zone);</PRE> <P> <HR> <H1><A NAME="description">DESCRIPTION</A></H1> <P>This module provides routines to format dates into ASCII strings. They correspond to the C library routines <A HREF="#item_strftime"><CODE>strftime</CODE></A> and <A HREF="#item_ctime"><CODE>ctime</CODE></A>.</P> <DL> <DT><STRONG><A NAME="item_time2str">time2str(TEMPLATE, TIME [, ZONE])</A></STRONG><BR> <DD> <A HREF="#item_time2str"><CODE>time2str</CODE></A> converts <CODE>TIME</CODE> into an ASCII string using the conversion specification given in <CODE>TEMPLATE</CODE>. <CODE>ZONE</CODE> if given specifies the zone which the output is required to be in, <CODE>ZONE</CODE> defaults to your current zone. <P></P> <DT><STRONG><A NAME="item_strftime">strftime(TEMPLATE, TIME [, ZONE])</A></STRONG><BR> <DD> <A HREF="#item_strftime"><CODE>strftime</CODE></A> is similar to <A HREF="#item_time2str"><CODE>time2str</CODE></A> with the exception that the time is passed as an array, such as the array returned by <A HREF="../../../lib/Pod/perlfunc.html#item_localtime"><CODE>localtime</CODE></A>. <P></P> <DT><STRONG><A NAME="item_ctime">ctime(TIME [, ZONE])</A></STRONG><BR> <DD> <A HREF="#item_ctime"><CODE>ctime</CODE></A> calls <A HREF="#item_time2str"><CODE>time2str</CODE></A> with the given arguments using the conversion specification <CODE>"%a %b %e %T %Y\n"</CODE> <P></P> <DT><STRONG><A NAME="item_asctime">asctime(TIME [, ZONE])</A></STRONG><BR> <DD> <A HREF="#item_asctime"><CODE>asctime</CODE></A> calls <A HREF="#item_time2str"><CODE>time2str</CODE></A> with the given arguments using the conversion specification <CODE>"%a %b %e %T %Y\n"</CODE> <P></P></DL> <P> <HR> <H1><A NAME="multilanguage support">MULTI-LANGUAGE SUPPORT</A></H1> <P>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</P> <PRE> Date::Format->language('German');</PRE> <P>will change the language in which all subsequent dates are formatted.</P> <P>This is only a first pass, I am considering changing this to be</P> <PRE> $lang = Date::Language->new('German'); $lang->time2str("%a %b %e %T %Y\n", time);</PRE> <P>I am open to suggestions on this.</P> <P> <HR> <H1><A NAME="conversion specification">CONVERSION SPECIFICATION</A></H1> <P>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.</P> <PRE> %% 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</PRE> <P> <HR> <H1><A NAME="author">AUTHOR</A></H1> <P>Graham Barr <<A HREF="mailto:Graham.Barr@pobox.com">Graham.Barr@pobox.com</A>></P> <P> <HR> <H1><A NAME="copyright">COPYRIGHT</A></H1> <P>Copyright (c) 1995-8 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.</P> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%> <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc"> <STRONG><P CLASS=block> Date::Format - Date formating subroutines</P></STRONG> </TD></TR> </TABLE> </BODY> </HTML>