Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
converting epoch seconds to usable date
its very likely I'm missing something, but what that something is alludes me. I'm trying to convert epoch seconds to a usable date format, but I'm having no luck at all. I don't want to use localtime() because it gives a huge string that I really can't use. What I'm after is a date formated like this: yyyy-mm-dd
Below is the code I'm working with and the resulting output.
4 use strict;
5 use Time::CTime;
7 my $epochSeconds = time;
9 my $theDate= strftime( '%Y-%M-%d', $epochSeconds );
11 print "The Epoch Seconds are: $epochSeconds
12 print "The Converted Date is: $theDate
The Epoch Seconds are: 1069474375
The Converted Date is: 1900-00-00
As far as I know the epoch seconds shown above is current to when the program ran and is the actual date and time that the program was run.
0 · ·