回复 15# gtluck |
perl - Time::Local - timegm
NAMETime::Local - efficiently compute time from local and GMT time
DESCRIPTIONThis module provides functions that are the inverse of built-in perlfunctions localtime() and gmtime(). They accept a date as asix-element array, and return the corresponding time(2) value inseconds since the system epoch (Midnight, January 1, 1970 GMT on Unix,for example). This value can be positive or negative, though POSIXonly requires support for positive values, so dates before thesystem's epoch may not work on all operating systems.
- $time = timelocal( $sec, $min, $hour, $mday, $mon, $year );
- $time = timegm( $sec, $min, $hour, $mday, $mon, $year );
It is worth drawing particular attention to the expected ranges forthe values provided. The value for the day of the month is the actualday (ie 1..31), while the month is the number of months since January(0..11). This is consistent with the values returned fromlocaltime() and gmtime().