Returns the selected data and time attribute of the file filename provided that this is supported by the operating and file system. FAT, for example, does not support Create/Access. The selector for the time to be returned can be abbreviated to the first character.

The filename can also be a directory name.

The file that you want to query must not be opened by another process or must at least allow shared writes to query the time stamp.



The name of the file to be queried.


The file time to be queried, namely CREATE, ACCESS, WRITE.

Return codes:

The date and time in the format YYYY-MM-DD HH:MM:SS, or -1 to indicate that the file date and time query failed


Say "File creation time:" SysGetFileDateTime("MyFile.Log", "C")
Say "File last access time:" SysGetFileDateTime("MyFile.Log", "A")
Say "File last update time:" SysGetFileDateTime("MyFile.Log", "W")

Say "Directory creation time:" SysGetFileDateTime("C:\MyDir", "C")
                                          /* in Windows NT */