Welcome to Stormstor.com

 
  Login/Create an Account    

Home
Gallery
mindterm
Downloads
Subjects
Email
Change

There isn't content right now for this block.

Convert UNIX epoch time
Posted on Saturday, May 06 @ 20:04:55 BST by delimia

Solaris how-to How do I convert unix time to a readable format?

[poxley@celeste ~]$ EPOCH=`date +%s`
[poxley@celeste ~]$
[poxley@celeste ~]$ echo $EPOCH
1146854736
[poxley@celeste ~]$ echo $EPOCH|awk '{print strftime("%c",$1)}'
Fri 05 May 2006 07:45:36 PM BST

To adjust the time, plus or minus e.g

[poxley@celeste ~]$ tstamp=`date +%s`
[poxley@celeste ~]$ (( adstamp =$tstamp - 86400 )) #less 24 hours
[poxley@celeste ~]$ echo $adstamp|awk '{print strftime("%c",$1)}'
Fri 05 May 2006 08:03:37 PM BST

Another method would be to use date -d:

[poxley@celeste ~]$ date -d '1970-01-01 sec'
Thu Jan  1 00:00:01 BST 1970
[poxley@celeste ~]$ date +%s
1147027276
[poxley@celeste ~]$ date -d '1970-01-01 1147027276 sec'
Sun May  7 18:41:16 BST 2006




 
Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

· More about Solaris how-to
· News by delimia


Most read story about Solaris how-to:
Convert UNIX epoch time


Average Score: 0
Votes: 0

Please take a second and vote for this article:

Excellent
Very Good
Good
Regular
Bad



 Printer Friendly Printer Friendly


Sorry, Comments are not available for this article.


Web site powered by PHP-Nuke

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2005 by me.
You can syndicate our news using the file backend.php or ultramode.txt
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.22 Seconds