Returns the time and date information for a file.
FileGetTime ( "filename" [, option = 0 [, format = 0]] )
The array is a single dimension array containing six or seven elements:
$aArray[0] = year (four digits)
$aArray[1] = month (range 01 - 12)
$aArray[2] = day (range 01 - 31)
$aArray[3] = hour (range 00 - 23)
$aArray[4] = min (range 00 - 59)
$aArray[5] = sec (range 00 - 59)
If "format" includes $FT_MSEC and $FT_ARRAY you get
$aArray[6] = msec (range 00 - 999)
If "format" includes $FT_MSEC and $FT_STRING FileGetTime returns a string YYYYMMDDHHMMSSnnn
Notice that return values are zero-padded.
FileGetAttrib, FileGetSize, FileGetVersion, FileSetAttrib, FileSetTime
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
Example()
Func Example()
; Create a constant variable in Local scope of the filepath that will be read/written to.
Local Const $sFilePath= _WinAPI_GetTempFileName (@TempDir )
; Set the modified timestamp of the file to 1st Nov 2003 and use the current time.
Local $iFileSetTime= FileSetTime ($sFilePath,"20031101",$FT_MODIFIED)
; Display the modified timestamp of the file and return as a string in the format YYYYMMDDHHMMSS.
If $iFileSetTimeThen
MsgBox ($MB_SYSTEMMODAL,"","Timestamp:"&@CRLF &FileGetTime ($sFilePath,$FT_MODIFIED,$FT_STRING))
Else
MsgBox ($MB_SYSTEMMODAL,"","An error occurred whilst setting the timestamp of the file.")
EndIf
; Delete the temporary file.
FileDelete ($sFilePath)
EndFunc ;==>Example