Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out the time since unix epoch for a certain date time?

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

like image 852
Amandasaurus Avatar asked Sep 01 '09 13:09

Amandasaurus


People also ask

What is the Unix epoch?

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.

What is Unix time?

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.

Is epoch time a point in time?

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?

How do I get the current date and time in Unix?

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:


1 Answers

Using date thus:

date --date="Oct 1 09:00:00 BST 2009" +%s

Yields:

1254384000
like image 159
Adam Bellaire Avatar answered Nov 13 '22 08:11

Adam Bellaire