1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
use strict;
use warnings;
use Test::More;
plan tests => 18;
use Class::Date qw(gmdate);
ok(1);
my $t = gmdate("2001-07-26 16:15:23");
is $t->set(year => 2002), "2002-07-26 16:15:23";
is $t,"2001-07-26 16:15:23";
is $t->set(_year => 105), "2005-07-26 16:15:23";
is $t,"2001-07-26 16:15:23";
is $t->set(month => 4), "2001-04-26 16:15:23";
is $t->set(mon => 9), "2001-09-26 16:15:23";
is $t->set(_month=> 7), "2001-08-26 16:15:23";
is $t->set(_mon => 2), "2001-03-26 16:15:23";
is $t->set(day => 12), "2001-07-12 16:15:23";
is $t->set(mday => 21), "2001-07-21 16:15:23";
is $t->set(day_of_month=>5), "2001-07-05 16:15:23";
is $t->set(hour => 14), "2001-07-26 14:15:23";
is $t->set(min => 34), "2001-07-26 16:34:23";
is $t->set(minute=> 19), "2001-07-26 16:19:23";
is $t->set(sec => 49), "2001-07-26 16:15:49";
is $t->set(second=> 44), "2001-07-26 16:15:44";
is $t->set(year => 1985, day => 16), "1985-07-16 16:15:23";
|