The basic datatype for datetime in Excel is a 64-bit floating-point number, where the day length is January 1 and January 1, 1900 00:00, equal to 1. Thus, on June 11, 2009, 5:30 p.m. about 39975.72917.
If a cell contains a numeric value such as this, it can be converted to date-time simply by applying the datetime format to the cell.
So, if you can convert your dates to numbers using the above formula, output them to the appropriate cells and then set the cell formats to the appropriate date and time format, for example. yyyy-mm-dd hh: mm: ss, then it should be possible to get what you want.
Stefan de Bruijn also pointed out that there is a mistake in Excel that it mistakenly assumes that 1900 is a leap year, so you need to take this into account when calculating ( Wikipedia ).
Adam Ralph Jun 11 '09 at 15:37 2009-06-11 15:37
source share