DateTime

DateTime is a date and time object.
Download

DateTime Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Dave Rolsky
  • Publisher web site:
  • http://search.cpan.org/~drolsky/

DateTime Tags


DateTime Description

DateTime is a date and time object. DateTime is a date and time object.SYNOPSIS use DateTime; $dt = DateTime->new( year => 1964, month => 10, day => 16, hour => 16, minute => 12, second => 47, nanosecond => 500000000, time_zone => 'Asia/Taipei', ); $dt = DateTime->from_epoch( epoch => $epoch ); $dt = DateTime->now; # same as ( epoch => time() ) $year = $dt->year; $month = $dt->month; # 1-12 - also mon $day = $dt->day; # 1-31 - also day_of_month, mday $dow = $dt->day_of_week; # 1-7 (Monday is 1) - also dow, wday $hour = $dt->hour; # 0-23 $minute = $dt->minute; # 0-59 - also min $second = $dt->second; # 0-61 (leap seconds!) - also sec $doy = $dt->day_of_year; # 1-366 (leap years) - also doy $doq = $dt->day_of_quarter; # 1.. - also doq $qtr = $dt->quarter; # 1-4 # all of the start-at-1 methods above have correponding start-at-0 # methods, such as $dt->day_of_month_0, $dt->month_0 and so on $ymd = $dt->ymd; # 2002-12-06 $ymd = $dt->ymd('/'); # 2002/12/06 - also date $mdy = $dt->mdy; # 12-06-2002 $mdy = $dt->mdy('/'); # 12/06/2002 $dmy = $dt->dmy; # 06-12-2002 $dmy = $dt->dmy('/'); # 06/12/2002 $hms = $dt->hms; # 14:02:29 $hms = $dt->hms('!'); # 14!02!29 - also time $is_leap = $dt->is_leap_year; # these are localizable, see Locales section $month_name = $dt->month_name; # January, February, ... $month_abbr = $dt->month_abbr; # Jan, Feb, ... $day_name = $dt->day_name; # Monday, Tuesday, ... $day_abbr = $dt->day_abbr; # Mon, Tue, ... $epoch_time = $dt->epoch; # may return undef if the datetime is outside the range that is # representable by your OS's epoch system. $dt2 = $dt + $duration_object; $dt3 = $dt - $duration_object; $duration_object = $dt - $dt2; $dt->set( year => 1882 ); $dt->set_time_zone( 'America/Chicago' ); $dt->set_formatter( $formatter );DateTime is a class for the representation of date/time combinations, and is part of the Perl DateTime project. For details on this project please see http://datetime.perl.org/. The DateTime site has a FAQ which may help answer many "how do I do X?" questions. The FAQ is at http://datetime.perl.org/faq.html.It represents the Gregorian calendar, extended backwards in time before its creation (in 1582). This is sometimes known as the "proleptic Gregorian calendar". In this calendar, the first day of the calendar (the epoch), is the first day of year 1, which corresponds to the date which was (incorrectly) believed to be the birth of Jesus Christ.The calendar represented does have a year 0, and in that way differs from how dates are often written using "BCE/CE" or "BC/AD".For infinite datetimes, please see the DateTime::Infinite module.Requirements:· Perl Requirements: · Perl


DateTime Related Software