FileGetTime( OutputVar, Filename [, WhichTime] ) - See
FileGetTime for more info.
The only difference is that this function returns
YYYYMMDDHH24MISSMIS instead of
YYYYMMDDHH24MISS
Code:
FileGetTime( time1, "C:\Windows", "M" )
FileGetTime, time2, C:\Windows , M
Msgbox, % time1 . "`n" . time2
; based on the built-in FileGetTime function
FileGetTime(ByRef OutputVar, Filename, WhichTime="M"){
OutputVar := ""
VarSetCapacity( WIN32_FIND_DATA, 318, 0 )
file := DllCall("FindFirstFile", "str", Filename, "UInt", &WIN32_FIND_DATA)
IfEqual, file, -1, return !(ErrorLevel:=1) ; INVALID_HANDLE_VALUE
DllCall("FindClose", "UInt", file)
If whichtime = C
pFILETIME := &WIN32_FIND_DATA + 4
Else if whichtime = A
pFILETIME := &WIN32_FIND_DATA + 12
Else If whichtime = M
pFILETIME := &WIN32_FIND_DATA + 20
Else
return !(ErrorLevel:=1)
VarSetCapacity(local_FILETIME, 8, 0)
If DllCall("FileTimeToLocalFileTime", "UInt", pFILETIME, "UInt", &local_FILETIME){
VarSetCapacity(SYSTEMTIME, 16, 0)
If DllCall("FileTimeToSystemTime", "UInt", &local_FILETIME, "UInt", &SYSTEMTIME){
VarSetCapacity(local_filetime_str, 128, 0)
If DllCall("msvcrt.dll\sprintf", "Str", local_filetime_str, "Str", "%04d%02d%02d" "%02d%02d%02d%03d"
, "UInt", NumGet(SYSTEMTIME,00,"UShort"), "UInt", NumGet(SYSTEMTIME,02,"UShort"), "UInt", NumGet(SYSTEMTIME,06,"UShort") ; Y M D
, "UInt", NumGet(SYSTEMTIME,08,"UShort"), "UInt", NumGet(SYSTEMTIME,10,"UShort") ; H M
, "UInt", NumGet(SYSTEMTIME,12,"UShort"), "UInt", NumGet(SYSTEMTIME,14,"UShort"), "CDecl")>=0 ; S MS
{
OutputVar := local_filetime_str
return !(ErrorLevel:=0)
}Else
return !(ErrorLevel:=1)
}
}
}