Formating a date as a date string for a locale specified

The GetDateFormat Windows API function formats a date as a date string for a Locale Identifier specified. The formatting is controlled either by flags or by the formatting string, if provided. The function accepts SYSTEMTIME Structure as one of its parameters.

File date and time


Code below shows how to retrieve file date and time using native VFP commands or WSH. For Windows API based solution that also allows to set file date and time, see George Tasker's Windows Time hosted on UT

MSDN links:

Convert Excel serial number date to VFP date


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