1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
imapsync/W/learn/date_manip
Nick Bebout c08a56e486 1.504
2012-09-02 19:08:57 -05:00

29 lines
747 B
Perl
Executable File

#!/usr/bin/perl -w
require Date::Manip;
Date::Manip->import(qw(ParseDate Date_Cmp UnixDate));
print "Date::Manip::VERSION $Date::Manip::VERSION\n";
foreach $date_inp ("21-Jan-2004 23:10:58 +0200", "21-Feb-2004 0:14:02 +0200",
"15-Oct-2004 23:25:42 +0200", "19-Aug-2005 1:49:08 +0200") {
$date_dm = ParseDate($date_inp);
$date_un = UnixDate($date_dm, "%g");
unless ($date_dm) {
print "Error in date [$date_inp]\n";
next;
}
print " $date_inp\n$date_un\n";
}
$date1 = ParseDate("21-Feb-2004 0:14:02 +0200");
$date2 = ParseDate("21-Feb-2004 00:14:02 +0200");
print "cmp date1 $date1 date2 $date2 : ", Date_Cmp($date1,$date2), "\n";
print "UnixDate ", UnixDate($date1, "%g"), "\n";
print "UnixDate ", UnixDate(undef, "%g"), "\n";