localtime - convert UNIX time into record or string using local time


localtime EXPR


Converts a time as returned by the time function to a 9-element array with the time analyzed for the local timezone. Typically used as follows:

($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. If EXPR is omitted, does localtime(time).

In a scalar context, prints out the ctime(3) value:

$now_string = localtime; # e.g. "Thu Oct 13 04:54:34 1994"

See also timelocal and the strftime(3) function available via the POSIX modulie.