Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert dd/mm/yyyy to epoch time in Perl?

I have searched several hours for a formula to convert dd/mm/yyyy format into epoch time but have not found a solution.

I have two dates, after converting from 2 different formats, that are now like this "08011985" and "09302014". I have to convert them to epoch time to get the difference from earliest and latest date, and do something based on the size of the spread.

I can't install any modules and am on 5.8.8.

like image 694
dbonneville Avatar asked Dec 06 '25 09:12

dbonneville


1 Answers

The built-in module Time::Local provides the inverse of localtime and gmtime, timelocal and timegm. They take dates and times and return epoch time.

perlfaq4 covers these sorts of questions.

like image 55
Schwern Avatar answered Dec 09 '25 08:12

Schwern



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!