Important Time Stamp Command (LINUX)

Posted on by By Nikhilesh, in Miscellaneous | 0

TIMESTAMP

timestamp is a sequence of characters or encoded information identifying when a certain event occurred, usually giving date and time of day, sometimes accurate to a small fraction of a second.

A timestamp is the current time of an event that is recorded by a computer. Through mechanisms such as the Network Time Protocol ( NTP ), a computer maintains accurate current time, calibrated to minute fractions of a second. Such precision makes it possible for networked computers and applications to communicate effectively.

How to Get timestamp in UNIX

Command         : –       date +%s

Result         : –        1405407447

How to convert timestamp into Date – time in UNIX

Command         : –    date -d @1405407447 +’%Y-%m-%d %H:%M:%S’

Result         : –                2014-07-15 01:57:27

How to set system Date Time in UNIX

Command       : –     date -s “11/20/2003 12:48:00”

Set the system date and time to November 20, 2003, 12:48 PM

How to get  GMT time Information  in UNIX

GMT time according to selected country..

Command  : –    TZ=’America/Los_Angeles’ date

Result         : –        Tue Jul 15 00:28:10 PDT 2014

Command  : –    TZ=’India’ date

Result         : –      Tue Jul 15 07:32:40 India 2014

How to convert Date into Unix timestamp

To convert Date time in to specific Timestamp

Method: 1

Command       : –    date -d “2010-10-02 17:56:56” “+%s”

Result               : –        1286060216

Method: 2

Command       : –   date –date=’06/12/2012 07:21:22′ +”%s”

Result               : –        1339503682

How to add and subtract Date

To add some days in specific Date

Command       : –    date -d ‘Jan 1 1982 + 11 days’

Result               : –     Tue Jan 12 00:00:00 EST 1982   

To add some Days and get the output in timestamp

Command       : –    date -d ‘Jan 1 1982 + 11 days’ +%s

Result              : –          379659600

To subtract some days in specific Date

Command       : –    date -d ‘Jan 1 1982 – 1 days’  

Result              : –    Thu Dec 31 00:00:00 EST 1981

 ****Pushpraj Kumar*****

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments