BreadCrumbs: Linux Time

Linux Time

From Luke Jackson

(Difference between revisions)
Jump to: navigation, search
Revision as of 14:15, 5 December 2007 (edit)
Ljackson (Talk | contribs)

← Previous diff
Current revision (14:16, 5 December 2007) (edit)
Ljackson (Talk | contribs)
(Convert Unix Timstamp)
 
Line 9: Line 9:
#!/bin/awk -f #!/bin/awk -f
{ print strftime("%c", $0); } { print strftime("%c", $0); }
-</pre+</pre>
Call the tool with the following command: Call the tool with the following command:
Line 28: Line 28:
* http://www.linuxhowtos.org/Tips%20and%20Tricks/converting_unixtimestamp.htm * http://www.linuxhowtos.org/Tips%20and%20Tricks/converting_unixtimestamp.htm
 +
 +[[Category:Linux]]
 +[[Category:Mac OS X]]

Current revision

Convert Unix Timstamp

Sometimes a program/tool prints its time information in unix timestamps. Unix timestamps are the seconds after 01/01/1970. This is usually unreadable by humans.

To convert this timestamp into something readable, copy the following small script into a searchable path and make it executable.

#!/bin/awk -f   
{ print strftime("%c", $0); }

Call the tool with the following command:

echo "your timestamp" | scriptname

You'll get an response according to your local timezone. Example:

$ date +%s   
1098181096   
$ echo "1098181096" | convertunixtime   
Tue Oct 19 12:18:16 2004

Sources

Personal tools