Operating System - HP-UX
1834149 Members
2366 Online
110064 Solutions
New Discussion

Could you help me with conversion unix system date to Epoch

 
SOLVED
Go to solution
Marcin_9
Frequent Advisor

Could you help me with conversion unix system date to Epoch

Hi,
As I know the system date in typical conversion is "friendly" readable like 17 jan 2005 17:50... for user. But in some case (like logs) there are epoch date converted. We would like to have easy way to put date as in data and have output in epoch conversion. Could you sugest solution?
2 REPLIES 2
Peter Godron
Honored Contributor
Solution

Re: Could you help me with conversion unix system date to Epoch

Marcin,
a often asked question. Have look at:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=243829
The various solutions involve either perl,C or lengthy shell scripts.

If you want other solutions please search the newsgroups with "epoch" as the keyword.

Regards
harry d brown jr
Honored Contributor

Re: Could you help me with conversion unix system date to Epoch

in perl or c you can use strftime.

perl -e 'use POSIX qw(strftime);$timeis=723838390;$tim=strftime "%Y%m%d.%H%M%S",localtime(${timeis});printf("time is %s.\n", $tim);'

also see: http://www.perl.com/lpt/a/2003/03/13/datetime.html

live free or die
harry d brown jr
Live Free or Die