1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
imapsync/W/learn/date_manip

29 lines
747 B
Plaintext
Raw Normal View History

2011-03-12 03:44:34 +01:00
#!/usr/bin/perl -w
require Date::Manip;
Date::Manip->import(qw(ParseDate Date_Cmp UnixDate));
2011-03-12 03:44:49 +01:00
print "Date::Manip::VERSION $Date::Manip::VERSION\n";
2011-03-12 03:44:34 +01:00
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";