- CONSTRUCTOR PARAMETERS
- COPYRIGHT & LICENSE
Date::Parser::Date - Simple date object
my $date = Date::Parser::Date->new( year => $year, month => $month, day => $day, hour => $hour, min => $min, sec => $sec, ); # or Date::Parser::Date->new(unixtime => $unixtime);
A simple date object.
The constructor. Attempts to construct sensible date and time values based on a simple algorithm. See "CONSTRUCTOR_PARAMETERS".
If unixtime is passed, it is used and other values are populated.
If year, month, day, hour, min and sec are provided, populates unixtime.
If only year, month and day are provided, uses all possible time values provided, and excepts noon otherwise - then populates unixtime.
If only hour and min (and optionally sec) are defined, sets date for today. Afterwards, unixtime is populated.
Returns Date::Format::time2str($format, $self->unixtime).
Returns date in unixtime.
Expects Date::Parser::Date-object. Returns a new Date::Parser::Date-object representing the time between self and given $date.
Expects Date::Parser::Date-object. Compares dates. Returns -1 if this object is before $date, 0 if dates match and 1 if this object is after $date.
Sets/overwrites a parameter $key with $value.
The constructor accepts following parameters:
Seconds since 1.1.1970, e.g. 1295784779
Integer year, e.g. 2 or 2011
Integer month (from 0-11).
Integer day of the month (from 1-31).
Integer hour in 24-hour format (from 0-23).
Integer minute (from 0-59).
Integer second (from 0-59).
This module doesn't verify the sanity of values given e.g. year => -102932.124
Copyright 2011 Heikki Mehtänen, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.