Linux epoch time or Unix time


If you need a convenient way to store the date in a database you will certainly use the unix format.
it’s very convenient because it doesn’t change notation from country to country.

You can later convert it back to a format that’s human readable.

in a shell on linux if you wish to display the current unix time. just type

date +%s

But if you need the unix time for a specific date ,

date –d=’03/14/2016 00:00:01′ +%s
or
date –d=’14 march 2016 00:00:01′ +%s

There is also the function to input an interval

date –d ‘1 hour ago’ +%s
date –d ‘1 month ago’ +%s

 

Leave a Comment

Your email address will not be published. Required fields are marked *