NAME

Mail::Date - convert to RFC2822 compliant date-time

SYNOPSIS

use Mail::Date;
print datetime_rfc2822(time, '+0900');

DESCRIPTION

Here it is a rfc2822 compliant date-time converter. The well-known RFC822 has already been obsoleted by RFC2822 on April 2001. And the standard format of expression for date-time has been updated in the RFC2822. An example which is shown next is obsoleted one:

Thu, 06 Mar 2003 19:14:05 GMT

Because it has an alphabetical string GMT for indicating a timezone. Now the RFC2822 specifies a timezone should be expressed in a numerical string like +hhmm or -hhmm. The former example should be displayed as next:

Thu, 06 Mar 2003 19:14:05 -0000

Moreover, the RFC2822 describes timezone SHOULD express local-time. The timezone -0000 does not mean the local-time of GMT (Greenwich Mean Time) but does universal-time (UTC). If it mean local-time at a place of GMT, the timezone +0000 SHOULD be used. So you know where you are and the local timezone's offset from UTC, you would specify timezone and local-time. For example, when you were at the time of second example of UTC, and you were in Japanese local-time where it is ahead of nine hours from UTC, the date-time expression is:

Fri, 07 Mar 2003 04:14:05 +0900

(Don't overlook that it is not only timezone but the date and time-of-day are also altered.)

Please consult RFC2822 (section 3.3, 4.3) for the actual infomation.

FUNCTIONS

datetime_rfc2822($machine_time [, $timezone])

This function returns RFC2822 compliant date-time string which is converted from a unix-machine-time. Though $timezone value is optional, it is said that in the RFC2822 The date and time-of-day SHOULD express local time. If $timezone value is not given (omitted), it will be not taken as a local-time but as a universal-time (UTC) to be expressed -0000.

The time zone expression should be compliant to the RFC2822 specification. It must be within the range -9959 through +9959. The "+" or "-" indicates whether the time-of-day is ahead of (i.e., east of) or behind (i.e., west of) Universal Time. The first two digits indicate the number of hours difference from Universal Time, and the last two digits indicate the number of minutes difference from Universal Time. (Hence, +hhmm means +(hh * 60 + mm) minutes, and -hhmm means -(hh * 60 + mm) minutes). The form "+0000" should be used to indicate a time zone at Universal Time.

SEE ALSO

RFC2822: http://www.ietf.org/rfc/rfc2822.txt
HTTP::Date (for the RFC822 compliant date-time)

AUTHOR

Masanori HATA <lovewing@geocities.co.jp> (Saitama, JAPAN)

COPYRIGHT

Copyright (c) 1999-2003 Masanori HATA. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.