DateTime::Precise

DateTime::Precise can perform common time and date operations with additional GPS operations.
Download

DateTime::Precise Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Blair Zajac
  • Publisher web site:
  • http://search.cpan.org/~bzajac/Apache-ConfigParser-1.01/lib/Apache/ConfigParser.pm

DateTime::Precise Tags


DateTime::Precise Description

DateTime::Precise can perform common time and date operations with additional GPS operations. DateTime::Precise can perform common time and date operations with additional GPS operations.SYNOPSIS use DateTime::Precise; use DateTime::Precise qw(:TimeVars); # Constructors and ways to set time. $t1 = DateTime::Precise->new; $t2 = DateTime::Precise->new('1998. 4. 3 12:13:44.054'); $t3 = DateTime::Precise->new(time() - 100.23456); $t4 = DateTime::Precise->new('1998.04.24'); $t1->set_localtime_from_epoch_time; $t1->set_gmtime_from_epoch_time(time + 120.987); $t1->set_from_datetime('1998.03.23 16:58:14.65'); $t1->set_time('YDHMS', 1998, 177, 9, 15, 26.5); # This is the same as $d3->set_from_datetime(...) $t3->dscanf("%^Y.%M.%D %h:%m:%s", "1998.03.25 20:25:23"); if ($msg = $d1->dscanf("%~M", $input)) { print "error: $msgn"; print "Must enter a three-letter month abbrev.n"; } # Get different parts of the time. $year = $t3->year; $month = $t3->month; $day = $t3->day; $hours = $t3->hours; $minutes = $t3->minutes; $seconds = $t3->seconds; ($year, $day_of_year) = $t3->get_time('Yj'); # Print times and dates. print $t2->asctime; print $t2->strftime('%T %C%n'); print $t2->dprintf("%^Y.%M.%D %h:%m:%s"); # datetime print $t2->dprintf("%~w %~M %-D %h:%m:%s CST %^Y"); # ctime # Copy times. my $t4 = $t2->copy; # Set one time object to the same time as another: set $t3 equal to $t2. $t3->clone($t2); # Find the difference between two times. $secs_from_midnight = $t4 - $t1; $secs_from_midnight = $t4->diff($t1); # Add seconds, days, months, etc to time. $t1 = $t4 + 3600; # $t1 is now an hour after midnight $t1->inc_month(2); # add two months to $t1 $t1->floor_month; # set $t1 to the first of the month $t1 -= 0.25; # subtract 1/4 of a second from $t1 # Can compare and sort DateTime::Precise. print "It's late!!!" if ($t1 > $t4); @sorted = sort @birthdays; # normal comparisons work fine # Get the GPS weeks, seconds and day. $gps_week = $t1->gps_week; $gps_seconds = $t1->gps_seconds; $gps_day = $t1->gps_day; ($gps_week, $gps_seconds, $gps_day) = $t1->gps_week_seconds_day;Requirements:· Perl


DateTime::Precise Related Software