The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
timestamps chriss_58 Shell Programming and Scripting 1 05-30-2008 02:12 AM
Difference between two timestamps raman1605 SUN Solaris 8 08-05-2007 04:54 PM
Find command to get the timestamps nguda Shell Programming and Scripting 8 03-24-2003 09:35 AM
Caluculate time between 2 unix timestamps? bozzhawg UNIX for Advanced & Expert Users 1 12-13-2001 11:37 AM
DiffElapsed time between unix timestamps help needed... bozzhawg UNIX for Dummies Questions & Answers 1 12-12-2001 08:06 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-07-2006
Registered User
 

Join Date: Jul 2005
Posts: 12
Lightbulb Unix timestamps

Can someone help me with a Unix or perl script to convert the unix timestamps to human readable format?


Any help will be highly appreciated...
Reply With Quote
Forum Sponsor
  #2  
Old 09-07-2006
Dhruva's Avatar
Registered User
 

Join Date: Mar 2006
Location: India
Posts: 255
what exactly you are looking for.Please elaborate!!!
Reply With Quote
  #3  
Old 09-07-2006
Registered User
 

Join Date: Jul 2005
Posts: 12
Say I am having a timestamp 1140444334642 which is an epoch. I want this to be converted to something like "02/20/2006 19:35:34"
Reply With Quote
  #4  
Old 09-07-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,699
Quote:
Originally Posted by hamsasal
Say I am having a timestamp 1140444334642 which is an epoch. I want this to be converted to something like "02/20/2006 19:35:34"
Woh ! That timestamp 1140444334642 actually made GNU date go back in time. Way before 1970. It went to 1906 ! I guess it must be some overflow, unless your epoch is different from a UNIX epoch.

What machine are you on ? From dictionary.com,
Code:
Under most Unix versions the epoch is 1970-01-01 00:00:00 GMT;
under VMS, it's 1858-11-17 00:00:00 (the base date of the US
Naval Observatory's ephemerides); on a Macintosh, it's
1904-01-01 00:00:00.
Anyway, if you have GNU date, then the answer to your question is

Code:
$ date -d '1970-01-01 UTC 1140444334642 seconds' +"%Y-%m-%d %T"
1906-02-01 03:38:26
I guess perl would have an in built functionality to do the same thing.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0