Panda::Date::Int - Interval date object.
Interval date is a period of time bound to particular point in time. Interval date consists of start date and end date.
Creates interval object from 2 dates. Input data can be anything that date() constructor supports.
Creates interval object from it's stringified form (->to_string) or array with from and till dates.
Set interval from data. This is much faster than creating new object.
Set interval from stringified form or array with from and till dates.
Lower date, Panda::Date.
Upper date, Panda::Date.
Converts interval to accurate number of seconds between from() and till().
Converts interval to accurate integer number of minutes between from() and till().
Converts interval to accurate number of minutes between from() and till().
Converts interval to accurate integer number of hours between from() and till().
Converts interval to accurate number of hours between from() and till().
Converts interval to accurate integer number of days between from() and till().
Converts interval to accurate number of days between from() and till().
Converts interval to accurate integer number of months between from() and till().
Converts interval to accurate number of months between from() and till(). Fractional part are based on how many days left till last day of month.
Converts interval to accurate integer number of years between from() and till().
Converts interval to accurate number of years between from() and till().
Returns Panda::Date::Rel that equals till() minus from(). Keep in mind that duration() not always equal to relative->duration() ! But from() + relative() always equals till()
duration()
from() + relative()
till()
Returns string in "<LOWER DATE> ~ <UPPER DATE>" format, for example "2012-01-01 03:04:05 ~ 2013-02-03 05:06:14". If any of 'till' or 'from' dates have error, returns undef.
Adds relative date to interval, i.e. adds reldate to it's lower and upper dates. Reldate can be Panda::Date::Rel object or any data valid for its constructor.
Same as add(), but changes current object instead of creating new one.
add()
Subtracts relative date from interval, i.e. subtracts reldate from its upper and lower dates. Reldate can be Panda::Date::Rel object or any data valid for its constructor.
Same as subtract_new(), but changes current object instead of creating new one.
subtract_new()
Compares 2 interval dates and return -1, 0 or 1. It's based on duration(). Interval date can be number (duration), Panda::Date::Int object or arrayref with constructor data.
Compares 2 intervals and returns true or false. It's based on full equality (i.e. from1 eq from2 and till1 eq till2). Interval date can be Panda::Date::Int object or arrayref with constructor data.
Swap from and till.
Same as negative_new(), but changes current object instead of creating new one.
negative_new()
Returns -1 if date presented by argument is greater than till() date.
Returns 0 if date is between from() and till() dates.
from()
Returns 1 otherwise.
Clones object.
Hook for Panda::Lib::clone().
See screenshot http://crazypanda.ru/v/clip2net/p/F/0WuXfVRKMM.png
Storable serialization is fully supported. That means you're able to freeze Panda::Date::Int objects and thaw serialized data back without losing any information.
Pronin Oleg <syber@cpan.org>, Crazy Panda, CP Decision LTD
You may distribute this code under the same terms as Perl itself.
To install Panda::Date, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Panda::Date
CPAN shell
perl -MCPAN -e shell install Panda::Date
For more information on module installation, please visit the detailed CPAN module installation guide.