Search code examples
perltimestamp

Convert Unix timestamp to a readable date in Perl


I have some Unix timestamps (for example, 1357810480, so they're mainly in the past). How can I transform them into a readable date-format using Perl?


Solution

  • You can use localtime for that.

    my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($unix_timestamp);