Page 1 of 1

Easy Qestion about FileGetTime

Posted: 16 Oct 2017, 18:32
by masheen
How to get file create day
i read help but cant understand

Code: Select all

FileGetTime, output, D:\123.txt
Msgbox % output ;need only day example 17

Re: Easy Qestion about FileGetTime  Topic is solved

Posted: 16 Oct 2017, 19:02
by JoeWinograd
You could simply use SubStr to get all of the date/time components. For example:

Code: Select all

FileGetTime,DateTime,D:\123.txt
Year:=SubStr(DateTime,1,4)
Month:=SubStr(DateTime,5,2)
Day:=SubStr(DateTime,7,2)
Also, note at the documentation that the default is Modification time, so if you really want Creation time, you'll need to specify C as the fourth parameter, i.e.:

Code: Select all

FileGetTime,DateTime,D:\123.txt,C
Regards, Joe

Re: Easy Qestion about FileGetTime

Posted: 16 Oct 2017, 19:22
by teadrinker
Also, you could use FormatTime:

Code: Select all

FileGetTime, DateTime, % A_AhkPath, C
MsgBox, % DateTime

FormatTime, Year, % DateTime, yyyy
FormatTime, Month, % DateTime, MM
FormatTime, Day, % DateTime, dd
MsgBox, Year = %Year%`nMonth = %Month%`nDay = %Day%