放在error handling
* Example
? ExcelSerialNumber2Date(39278)
&& 2007-07-15
? ExcelSerialNumber2Datetime(39278.456777)
&& 2007-07-15 10:57:46
? ExcelSerialNumber2Time(.456777)
&& 10:57:46
RETURN
*--------------------------------------------------------------------
* Convert Excel serial number to a date
FUNCTION ExcelSerialNumber2Date(tnExcelSerialNumber)
RETURN {^1899/12/30} + tnExcelSerialNumber
* Convert Excel serial number to a datetime
FUNCTION ExcelSerialNumber2Datetime(tnExcelSerialNumber)
RETURN DTOT({^1899/12/30} + INT(tnExcelSerialNumber)) + ;
ROUND(24*60*60 * (tnExcelSerialNumber % 1),0)
* Convert Excel serial number to a time string
FUNCTION ExcelSerialNumber2Time(tnExcelSerialNumber)
RETURN SUBSTR(TTOC({^2000/01/10 00:00:00} + ROUND(24*60*60 * (tnExcelSerialNumber % 1),0),3), 12)