A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label seconds. Show all posts
Showing posts with label seconds. Show all posts

Easy way to convert epoch seconds to human readable date in Perl

Easiest way:
print scalar localtime(946684800);
Prints:
Sat Jan  1 00:00:00 2000

Next easiest, more flexible:
require POSIX; print POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime((946684800)));
Prints:
2000-01-01 00:00:00