The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Palm::Progect::Date - utility routines for converting dates

SYNOPSIS

    use Palm::Progect::Date;

    $date_due = parse_date('2038/12/31', 'yyyy/mm/dd');
    $date_due = parse_date('12-31-38', 'mm-dd-yy');

    my $formatted_date = format_date($time_in_unix_format, 'yyyy/mm/dd');

DESCRIPTION

These routines are used by the Palm::Progect::* modules to parse and format dates.

SUBROUTINES

format_date($time, $date_format)

Given a time in Unix format (i.e. seconds since the epoch), return a string representation of the date based on the given format:

    my $formatted_date = format_date($time_in_unix_format, 'yyyy/mm/dd');

    print format_date(0, 'yyyy-mm-dd'); # prints "1969-12-31"

The format can include the following symbols:

yyyy

Four digit year

yy

Last two digits of year

mm

Month number

dd

Day number

parse_date($date_string, $date_format)

Attempt to parse $date_string as a textual representation of a date, using template supplied in $date_format:

    my $time = parse_date('2038/10/24', 'yyyy/mm/dd')

    print parse_date('12-31, 1969', 'mm-dd, yyyy'); # prints 0

No attempt is made to guess the format of $date_string; it is assumed that you know its format.

$date_format can include the following symbols:

yyyy

Four digit year

yy

Last two digits of year

mm

Month number

dd

Day number

BUGS and CAVEATS

The two digit date format will fail for dates before 1950 or after 2049 :).

AUTHOR

Michael Graham <mag-perl@occamstoothbrush.com>

Copyright (C) 2002-2005 Michael Graham. All rights reserved. This program is free software. You can use, modify, and distribute it under the same terms as Perl itself.

The latest version of this module can be found on http://www.occamstoothbrush.com/perl/

SEE ALSO

progconv

Palm::PDB(3)

http://progect.sourceforge.net/