Re: Date conversions
- Posted by Scott Murray <FaIkon1313 at AOL.COM> May 26, 1999
- 381 views
> 1 01/01/1980 1 25 72 0 0 {37,114,0,0} >11 01/01/2000 7306 AE 8E 0 0 {174,142,0,0} Oh, just noticed the part about the way the bytes are stored. Conversion to atoms appears to be a straightforward (b2 * #100 + b1 - 29220). Don't know why that is, but I guess it could go back a few years (however many are in 29220 days) before 1980, since 01/01/1980 is stored as 29221. revised test code: --===== TEST CODE =====-- sequence testdates testdates = { 1, 2, 32, 367, 731, 7061, 7062, 7063, 7092, 7305, 7306 } sequence testbytes testbytes = { {#25, #72}, {#26, #72}, {#44, #72}, {#93, #73}, {#FF, #74}, {#B9, #8D}, {#BA, #8D}, {#BB, #8D}, {#D8, #8D}, {#AD, #8E}, {#AE, #8E} } for c = 1 to length( testdates ) do printf( 1, "%02d/%02d/%4d\n", BG_to_mmddyyyy( testdates[c] ) ) end for atom blah for c = 1 to length( testbytes ) do position( c, 15 ) blah = testbytes[c][2] * #100 + testbytes[c][1] - 29220 printf( 1, "%02d/%02d/%4d\n", BG_to_mmddyyyy( blah ) ) end for