Synopsis: |
| getcenturyfromdate.pl |
| ||
sub GetCenturyFromDate($)
{
my ($t) = @_;
return int(((localtime shift)[5] + 1900) / 100);
}
#-- unit tests
sub test_getcenturyfromdate()
{
ut::assert(GetCenturyFromDate(0), 19);
ut::assert(GetCenturyFromDate(28799), 19);
ut::assert(GetCenturyFromDate(28800), 19); #28800 seconds is 8 hours
ut::assert(GetCenturyFromDate(1056523422), 20);
ut::assert(GetCenturyFromDate(1096523422), 20);
}
1;
|
| Contact me about content on this page using john_web-at-arrizza-dot-com |
| For Web Master or site problems contact: webadmin-at-arrizza-dot-com |
| Copyright John Arrizza (c) 2001-2010 |