overrider Posted October 17, 2006 Posted October 17, 2006 Hello all, i am trying to parse a logfile which begins with a timestamp like this "1146707632" . on mac osx, running date -r 1146707632 show that it means Thu May 4 09:53:52 HKT 2006 . is there a sane way to calculate timestamps to unix / epoch time and back? thanks a lot, overrider
comment Posted October 17, 2006 Posted October 17, 2006 To convert Unix time to Filemaker timestamp: UnixTime + 62135596800 + TZ * 3600 where TZ is the difference, in hours, between your local time and UTC (Unix time is always UTC). It seems you are in Hongkong timezone, so that would make TZ = 8 (further adjustment for daylight saving may be required).
wplate Posted November 6, 2006 Posted November 6, 2006 (edited) I have a similar need, but instead of a Timestamp result I need the results in a date field. I don't need the time, just the date. Thank you for help. Edited November 6, 2006 by Guest
comment Posted November 6, 2006 Posted November 6, 2006 Try: Div ( UnixTime + 62135596800 + TZ * 3600 ; 86400 ) + 1
wplate Posted November 6, 2006 Posted November 6, 2006 Try: Div ( UnixTime + 62135596800 + TZ * 3600 ; 86400 ) + 1 Hmmmm, the result I get doesn't look very date-like. I am starting out with the value 1162837975, and I want to turn it into 11/06/2006. The calculation above returned 2588996659
comment Posted November 6, 2006 Posted November 6, 2006 Huh? If I plug 1162837975 in UnixTime, and -8 in TZ, I get: Div ( 1162837975 + 62135596800 - 8 * 3600 ; 86400 ) + 1 This returns 732621. If the result is Date, it will translate to Nov 6, 2006.
wplate Posted November 6, 2006 Posted November 6, 2006 I had left out the -8 'cause I thought it wouldn't matter, but you're right that when I do the calculation again I get the number you cite. But I wasn't getting this entry formatted as a date when my script entered it, so I added the GetAsDate function, and now all is well. Thanks! GetAsDate (Div (LineItems::M_TRAN_DATE + 62135596800 -8 * 3600 ; 86400 ) + 1 )
Recommended Posts
This topic is 6653 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now