NAME
Date::ISO - Perl extension for converting dates between ISO and Gregorian formats.
SYNOPSIS
use Date::ISO;
$iso = Date::ISO->new( iso => $iso_date_string );
$iso = Date::ISO->new( epoch => $epoch_time );
$iso = Date::ISO->new( ical => $ical_string );
$iso_year = $iso->iso_year;
$year = $iso->year;
$iso_week = $iso->iso_week;
$week_day = $iso->iso_week_day;
$month = $iso->month;
$day = $iso->day;
DESCRIPTION
Convert dates between ISO and Gregorian formats.
new
my $iso = Date::ISO->new( iso => $iso_date_string );
my $iso = Date::ISO->new( epoch = $epoch_time );
And, since this is a Date::ICal subclass ...
my $iso = Date::ISO->new( ical => $ical_string );
$ical = $iso->ical;
Accepted ISO date string formats are:
1997-02-05 (Feb 5, 1997)
19970205 (Same)
199702 (February 1997)
1997-W06 (6th week, 1997)
1997W06 (Same)
1997-W06-2 (6th week, 2nd day)
1997W062 (Same as above)
1997-035 (35th day of 1997)
1997035 (Same as above)
2-digit representations of the year are not supported at this time.
Time values are not supported at this time.
#}}}
to_iso
( $isoyear, $isoweek, $isoday ) = to_iso( $year, $month, $day );
Returns the iso year, week, and day, given the gregorian year, month, and day. This should be considered an internal method, and is subject to change at any time.
from_iso
($year, $month, $day) = from_iso($year, $week, $day);
Given an ISO year, week, and day, returns year, month, and day, as localtime would give them to you. This should be considered an internal method, and is subject to change in future versions.
#}}}
1;
AUTHOR
Rich Bowen (rbowen@rcbowen.com)
DATE
$Date: 2001/07/30 00:50:07 $
Additional comments
For more information about this calendar, please see:
http://personal.ecu.edu/mccartyr/ISOwdALG.txt
http://personal.ecu.edu/mccartyr/isowdcal.html
http://www.cl.cam.ac.uk/~mgk25/iso-time.html
To Do, Bugs
Need to flesh out test suite some more. Particularly need to test some dates immediately before and after the first day of the year - days in which you might be in a different Gregorian and ISO years.
ISO date format also supports a variety of time formats. I suppose I should accept those as valid arguments.
Creating a Date::ISO object with an ISO string, and then immediately getting the ISO string representation of that object, is not giving back what we started with. I'm not at all sure what is going on.
# CVS History #{{{
Version History
$Log: ISO.pm,v $
Revision 1.19 2001/07/30 00:50:07 rbowen
Update for the new Date::ICal
Revision 1.18 2001/07/24 16:08:11 rbowen
perltidy
Revision 1.17 2001/04/30 13:23:35 rbowen
Removed AutoLoader from ISA, since it really isn't.
Revision 1.16 2001/04/29 21:31:04 rbowen
Added new tests, and fixed a lot of bugs in the process. Apparently the
inverseiso function had never actually worked, and various other functions
had some off-by-one problems.
Revision 1.15 2001/04/29 02:42:03 rbowen
New Tests.
Updated MANIFEST, Readme for new files, functionality
Fixed CVS version number in ISO.pm
Revision 1.14 2001/04/29 02:36:50 rbowen
Added OO interface.
Changed functions to accept 4-digit years and 1-based months.