FileGetTime

Retrieves the datetime stamp of a file or folder.

Timestamp := FileGetTime(Filename, WhichTime)

Parameters

Filename

Type: String

The name of the target file or folder, which is assumed to be in A_WorkingDir if an absolute path isn't specified. If omitted, the current file of the innermost enclosing File-Loop will be used instead.

WhichTime

Type: String

Which timestamp to retrieve:
M = Modification time (this is the default if the parameter is omitted)
C = Creation time
A = Last access time

Return Value

Type: String

This function returns a string of digits in the YYYYMMDDHH24MISS format. The time is your own local time, not UTC/GMT. This string should not be treated as a number (one should not perform math on it or compare it numerically).

Error Handling

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

A_LastError is set to the result of the operating system's GetLastError() function.

Remarks

See YYYYMMDDHH24MISS for an explanation of dates and times.

Related

FileSetTime, FormatTime, FileGetAttrib, FileSetAttrib, FileGetSize, FileGetVersion, File-loop, DateAdd, DateDiff

Examples

#1

Timestamp := FileGetTime("C:\My Documents\test.doc")  ; Retrieves the modification time by default.
Timestamp := FileGetTime("C:\My Documents\test.doc", "C")  ; Retrieves the creation time.