Unix TimeStamp Command

  • Updated
  • Posted in Programming
  • 2 mins read


What is Unix Timestamp

Unix timestamp is the illustration of time because the working complete of variety of seconds for the reason that unix epoch time on January 1st, 1970. Simply the Unix timestamp is the variety of seconds between the actual date and the Unix Epoch.

The unix timestamp develop into customary in laptop techniques for monitoring the data particularly in distributed processing system like hadoop, cloud computing and so on.

Here we are going to see the best way to convert the unix date to timestamp and unix timestamp thus far. We can even see the best way to generate the unix present timestamp. Let see each:

1. Unix Current Timestamp

To discover the unix present timestamp use the %s choice within the date command. The %s choice calculates unix timestamp by discovering the variety of seconds between the present date and unix epoch.

date '+%s'
1327312578

You will get a unique output should you run the above date command.

2. Convert Unix Timestamp to Date

You can use the -d choice to the date command for changing the unix timestamp thus far. Here it’s important to specify the unix epoch and the timestamp in seconds.

date -d "1970-01-01 956684800 sec GMT"
Tue Apr 25 10:46:40 PDT 2000

3. Convert Unix Date to Timestamp

You have to mix the -d choice and the %s choice for changing the unix date to timestamp.

date -d "2000-01-01 GMT" '+%s'
946684800

Recommended Posts:


Unix Date Command

Leave a Reply