Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: rpcwongSome of my data has the unix timestamp (seconds since standard epoch of 1/1/1970). I want to convert them back to "normal" date and time, but I'm having difficulties.
From BRAINscript Language help page, i see
timestamp(epochMs)
Evaluates to the datetime value represented by number of milliseconds since the epoch, 1970-1-1 00:00:00, in the local timezone.
epochMs must be long
When I try running the following codes:
firstTime_date = timestamp(long(firstTime))
currenttime = timestamp()
emit firstTime, firstTime_date, currenttime
I get the following output:
1267466695.02 1970-01-15 16:04:26.695000 2010-03-03 14:26:37
1267466865.05 1970-01-15 16:04:26.865000 2010-03-03 14:26:37
1267466728.77 1970-01-15 16:04:26.729000 2010-03-03 14:26:37
1267466865.07 1970-01-15 16:04:26.865000 2010-03-03 14:26:37
1267466870.99 1970-01-15 16:04:26.871000 2010-03-03 14:26:37
But when I tried entering the unix timestamp on some online tool such as
http://www.unixtimestamp.com/index.php
I do get reasonable Date (Mar 1, 2010 instead of Jan 15, 1970):
TIME STAMP: 1267466695.02
DATE: 03 / 01 / 10 @ 12:04:55pm
Thoughts? Suggestions?