Difference between revisions of "Date"

From Notes_Wiki
(Created page with "<yambe:breadcrumb>System_administration_tools|System Administration Tools</yambe:breadcrumb> =date= ==Convert date from human readable format to seconds since epoch (1 Jan 19...")
 
m
Line 12: Line 12:
1449907919
1449907919
</pre>
</pre>


==Convert date from seconds since 1970 to human readable format==
==Convert date from seconds since 1970 to human readable format==
Line 22: Line 23:
<pre>
<pre>
Sat Dec 12 13:41:59 IST 2015
Sat Dec 12 13:41:59 IST 2015
</pre>
==Convert date from other timezone to system time zone==
To convert date from other timezone to system time zone use something similar to:
<pre>
  date -d "2016-05-06 09:00:00 CDT"
</pre>
</pre>

Revision as of 10:25, 4 August 2016

<yambe:breadcrumb>System_administration_tools|System Administration Tools</yambe:breadcrumb>

date

Convert date from human readable format to seconds since epoch (1 Jan 1970)

To convert date from human readable format to seconds since epoch use command similar to:

date -d "2015-12-12 13:41:59" +%s

Example output would be:

1449907919


Convert date from seconds since 1970 to human readable format

To convert date from seconds since 1970 to human readable format use command similar to:

date -d@1449907919

Example output would be:

Sat Dec 12 13:41:59 IST 2015


Convert date from other timezone to system time zone

To convert date from other timezone to system time zone use something similar to:

   date -d "2016-05-06 09:00:00 CDT"