Date/Time format
ChrLie
I have imported numeric date/time data from a third party logging system as DP wave. The numeric values look like:
•print/D Date_time[0]
44244.4666145602
44244.4666145602
The data was recorded on Feb. 17th 2021, so it doesn't seem to be the year-1904 based encoding system. I played with table formatting and Secs2Date/Secs2Time but I didn't get the expected date-time values. Throwing the same numeric data into a spreadsheet program and changing the display format, however, gives the recording time.
I'm sure I'm missing something obvious, maybe someone can point me in the right direction!
Thanks!
I think I read somewhere that Excel on a Mac uses 1st Jan 1904 as the origin date, but on Windows it is Dec 1899.
February 18, 2021 at 12:41 am - Permalink
That is Excel time, if you want it in Igor time you need to do something like:
SetScale/P x 0,1,"dat", timewave
SetScale d 0,0,"dat", timewave
// example
print secs2date((44244.4666145602 * 86400) -(date2secs(1908,1,2)) ,0), secs2time((44244.4666145602 * 86400) -(date2secs(1908,1,2)) ,0)
17/02/2021 11:11
February 18, 2021 at 02:18 am - Permalink
Hi Kurt
thanks for the hint, your are right! I finally found the documentation of the format:
"Single, floating-point number. The integer part is the number of days since 31st Dec 1899, the decimal part is the proportion of the day since mid- night. For example, Noon on the 1st Jan 1900 would be represented by a value of 1.5, whilst a value of 34121.25 would represent the 6 am on the 1st June 1993."
I guess there are no simple built-in tools for conversion. Unfortunately I want to synchronise these data with some other from another logging system (string-based timestamp).
February 18, 2021 at 02:22 am - Permalink
@cpr:
Awesome, that gives the actual recording time, although I'm still puzzled by the different reference dates, i.e. 1899 vs. 1908 vs. 1904.
Thanks a lot!
February 18, 2021 at 02:34 am - Permalink
@ChrLie
1908 is there in there code not for any special reason other than 1900 wasn't a leap year and 4 years away from 1904 without having to deal with century years when you're tired!
February 18, 2021 at 02:45 am - Permalink
thanks for the explanation, much appreciated!
February 18, 2021 at 03:31 am - Permalink