You are here:Home»KB»Applications»Microsoft Office»how to convert an Excel date to a correct Unix timestamp
Wednesday, 23 June 2010 15:06

how to convert an Excel date to a correct Unix timestamp

Written by
=(A1 - 25569)*86400 

Where A1 is a cell set to display as a date. Set the cell with the above formula to display as a plain numder, and I think it will display the timestamp value.

Based on this page about the reverse transformation. 

=(A1 / 86400) + 25569


This method does not seem to be correct

If we assume the date in Excel is in A1 cell formatted as Date and the Unix timestamp should be in a A2 cell formatted as number the formula in A2 should be:

= (A1 * 86400) - 2209075200

where:

86400 is the number of seconds in the day 2209075200 is the number of seconds between 1900-01-01 and 1970-01-01 which are the base dates for Excel and Unix timestamps.

The above is true for Windows. On Mac the base date in Excel is 1904-01-01 and the seconds number should be corrected to: 2082844800

Read 848 times