I want to find out the time in unix time (ie seconds since the unix epoch) on 9:00 BST on 1st October 2009. How can I do this on the linux command line?
I know you can use date @$UNIXTIME '+%someformat'
, but the unix time is what I'm trying to figure out
This is often referred to as the Unix Epoch. Programmers chose this date for the epoch out of convenience since it was the closest round date when they invented Unix time. You may well have seen this date when something has gone wrong.
Unix time is a count of total seconds since a fixed time and date. It’s a date/time (or timestamp) format that looks different from the human-readable dates and times we’re used to. This is purely for efficiency reasons.
But the Epoch time is not a point in time, but a large counter – specifically, a number of seconds elapsed since the beginning on Unix time. Does Epoch Time differ with timezones?
On Linux and macOS, the date program is the core utility for dealing with date/time, including Unix timestamps. Called without any arguments, it returns the current date/time in a human-readable format: If you need the current date/time in Unix time, use the +%s argument:
Using date
thus:
date --date="Oct 1 09:00:00 BST 2009" +%s
Yields:
1254384000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With