($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
All array elements are numeric, and come straight out of a struct tm. In particular this means that $mon
has the range 0..11 and $wday
has the range 0..6 and $year
is year-1900, that is, $year
is 123 in year 2023. If
EXPR is omitted, uses the current time (``localtime(time)'').
In a scalar context, returns the ctime
value:
$now_string = localtime; # e.g., "Thu Oct 13 04:54:34 1994"
Also see the Time::Local module, and the strftime
function available via the
POSIX module.