In case you were wondering what is the epoch that sometime we talk about, it is the "start of the time" - as understood by your Linux/Unix-based computer.

Also know as the "creation of the world".

As you will see, it happened to fall on a Thursday.


use strict;
use warnings;
use 5.010;
use DateTime;

say scalar gmtime(0);

say scalar localtime(0);

my $dt = DateTime->from_epoch( epoch => 0 );
say $dt;

my $time = time();
say $time;
say scalar localtime($time);

In the output first you'll see the epoch in London (or more precisely in Greenwich) then the same in any location that is in the GMT+2 timezone.

Then the same, formatted using the DateTime class.

Finally the value returned by the time function which is the current time in seconds since the epoch and the same in a more readable format. (Yes, you see it well, I wrote this article on a Sunday at 7 am.)

Thu Jan  1 00:00:00 1970
Thu Jan  1 02:00:00 1970

1572757196 Sun Nov 3 07:01:41 2019