Date::Handler

Easy but complete date object (1.1)
Download

Date::Handler Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Benoit Beausejour
  • Publisher web site:
  • http://search.cpan.org/~bbeausej/DBIx-Sequence-1.5/Sequence.pm

Date::Handler Tags


Date::Handler Description

Easy but complete date object (1.1) Date::Handler is an easy but complete date object (1.1).SYNOPSIS use Date::Handler; my $date = new Date::Handler({ date => time, time_zone => 'Europe/Paris', locale => 'french'}); my $date = new Date::Handler({ date => , time_zone => 'EST', }); my $date = new Date::Handler({ date => { year => 2001, month => 4, day => 12, hour => 3, min => 1, sec => 55, }, time_zone => 'America/Los_Angeles', locale => 'en_US', }); print $date; print "$date"; print $date->AllInfo(); $date->new() Constructor $date->Year() 2001 $date->Month() 1..12 $date->Day() 1..31 $date->Hour() 0..23 $date->Min() 0..59 $date->Sec() 0..59 $date->Epoch($epoch) Seconds since epoch (GMT) $date->TimeZone() America/Montreal,EST,PST and so on $date->Locale() french, en_US, fr_FR, spanish and so on $date->SetLocale(locale) Set the locale to the argument, returns locale or undef. $date->LocaleRealName() Current locale's real name on the system $date->TimeZoneName() EST, PST and so on $date->LocalTime() localtime of the object's epoch $date->TimeFormat($format_string) strftime $date->GmtTime() gmtime of object's epoch $date->UtcTime() same as GmtTime() $date->GmtOffset() Offset of object's TZ in seconds $date->MonthName() April $date->WeekDay() 1..7 (1 monday) $date->WeekDayName() Wednesday $date->FirstWeekDayOfMonth() 1..7 $date->WeekOfMonth() 1..4 $date->DaysInMonth() 31,30,29,28 depending on month and year. $date->IsLeapYear() 1 if true, 0 if false $date->DayLightSavings() 1 if true, 0 if false $date->DayOfYear() Return the day of the year $date->DaysInYear() Returns the number of days in the year. $date->DaysLeftInYear() Returns the number of days remaining in the year $date->Array2Epoch([]) Transfer to epoch time $date->AsScalar () Same as TimeFormat("%A, %B%e %Y %R (%Z)") $date->AsNumber() same as Epoch() $date->AsArray() Returns $date->AsHash() Returns { year => y, month => m, day => d, hour => h, min => mm, sec => ss } $date->AllInfo() Returns a string containing all of the Object's related information. my $delta = new Date::Handler::Delta(); my $delta = new Date::Handler::Delta({ years => 3, months => 1, days => 10, hours => 2, minutes => 5, seconds => 5, }); $delta->new (More information in perldoc Date::Handler::Delta) $delta->Months() Number of months in delta $delta->Seconds() Number of seconds in delta $delta->AsScalar() "%d months and %d seconds" $delta->AsNumber() "%d-%d-%d" $delta->AsArray() $delta->AsHash() { months => m, seconds => ss } $date + $delta = Date::Handler $date - $delta = Date::Handler $date - $date2 = Date::Handler::Delta $date + n = (+n seconds) $date - n = (-n seconds) $delta + $delta = Date::Handler::Delta $delta - $delta = Date::Handler::Delta $delta * n = Date::Handler::Delta $delta / n = Date::Handler::Delta $delta + n = (+n seconds) $delta - n = (-n seconds) my $range = Date::Handler::Range->new({ date => $date, delta => $delta, }); my $range = Date::Handler::Range->new({ date => , delta => , }); $range->new (More info in perldoc Date::Handler::Range) $range->Direction() Specifies the direction of a range ('FORWARDS' || 'BACKWARDS') $range->StartDate() Start Date::Handler object for this range and direction $range->EndDate() End Date::Handler object for this range and direction $range->Overlaps($range2) Returns true if range overlaps range2. undef otherwise.Date::Handler is a container for dates that holds all the methods to transform itself from Timezone to Timezone and format itself. This module idea comes from an original version written by dLux (Szabó, Balázs) in his module Class::Date.Date::Handler is implemented in pure Perl using POSIX modules, it encapsulates the environnement variable TZ for it's time zone management so you don't have to play with it externally in the implementation. Date::Handler also supports localisation using POSIX where available.It uses operator overloading and Delta date objects to calculates time differences. Requirements: · Perl


Date::Handler Related Software