Is it possible to convert timi milis since the epoch in Perl using Time::Local or another package that is included with the standard Perl distribution, i.e. which doesn’t have to be added separately using a package manager like ppm? The problem is, I work in a super-restricted network environment and the script I am writing doesn’t warrant going through the red tape to get something external like DateTime or Time::HiRes.
E.g., I have milis like 1354996539 and I would like to format it to 2012-12-11 13:45:34
Thanks
Time::Local’s
timelocaldoes the opposite of what you want (1354996539 is the output, not the input). The function after which it’s named,localtime, is actually the one you want.Outputs (for someone in America/Toronto):
You can also do it without
strftime: