programming-examples/perl/Datatype/gmtime function converts a time value into Greenwich Mean Time.pl

19 lines
725 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
The gmtime function converts a time value into an array of nine elements.
You can extract each of the elements with code like the following:
($sec, $min, $hour, $dom, $mon,$year, $wday, $yday, $isdst) = gmtime($time);
Array Values Returned by gmtime Functions
Value Holds
$sec Seconds after the minute, from 0 to 59.
$min Minutes after the hour, from 0 to 59.
$hour Hour of day, from 0 to 23.
$dom Day of month, from 1 to 31.
$mon Month of year, from 0 to 11.
$year Years since 1900.
$wday Days since Sunday, from 0 to 6.
$yday Days since January 1, from 0 to 365.
$isdst Daylight-savings time; > 0 if in effect, 0 if not, < 0 if Perl can't tell.