Convert Excel serial number date to VFP date
By Sergey - Posted on January 1st, 2008
Excel stores dates as the number of days since 1900-01-00. The number 1 represents 1900-01-01 and so on. The time part, if present, is represented as decimal portion. There's a bug in implementation of that sequence. It assumes that there was 1900-02-29 but 1900 is not a leap year. As result the code below correctly convert dates starting with 1900-03-01 only.
For more info about Excel dates see How to use dates and times in Excel and Dates And Times In Excel.
| This is sample code. Add error handling and adjust to your requirements as necessary. |
&& Convert Excel serial number to date FUNCTION ExcelSerialNumber2Date(tnExcelSerialNumber) RETURN {^1899/12/30} + tnExcelSerialNumber &&----------------------------------------------- && Example ? ExcelSerialNumber2Date(39278) && 2007-07-15
See Also Convert Unix time to datetime
Recent comments
7 hours 14 min ago
1 week 19 hours ago
4 weeks 10 hours ago
5 weeks 1 hour ago
5 weeks 1 hour ago
7 weeks 4 days ago
8 weeks 1 day ago
8 weeks 1 day ago
8 weeks 4 days ago
8 weeks 4 days ago