Pitonyak::DateUtil - Format and convert Time/Date strings
use Pitonyak::DateUtil;
A time is formatted based on a format string. The number of times that a special character exists indicates the number of digits that will be used. The format character 'YYYYMMDD.hhmmss' yields a four digit year, two digit month, two digit day, a period, two digit hour, etc... Characters that are not considered special are inserted verbatim. Characters that are escaped with a backslash '\' are also inserted verbatim. Use '\\' to insert a backslash.
The special format characters are as follows:
Convert time and date information between different formats. This can convert between text representations and an integer.
Ignoring the time to make the call, both of the following calls are equivalent.
time_date_str($format_string); time_date_str($format_string, time());
This will return a formatted string with the specified time.
Convert a formatted time/date string to the same output as timelocal().
returns ($sec, $min, $hours, $mday, $mon, $year) where the $year will be -1 on error. December is mapped to 11 and the year 1900 is mapped to 0. One digit years are always mapped to 200y and two digit years are windowed so that 00-79 map to 20xx and 80-99 map to 19xx. Three digit years are obvious
Convert a formatted time/date string to an integer. -1 is returned on error.
Change a formatted time/date string to a different format.
This is nothing more than a shortcut to using time_date_str($desired_format, time_date_str_to_int($current_format, $formatted_time_date_string));
Copyright 1998-2002, Andrew Pitonyak (perlboy@pitonyak.org)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Version 1.00 First release
Version 1.01 Changed internal documentation to POD documentation. Added parameter checking.