I've encountered a problem with a single file where I cannot retrieve it's Date-time. So far my code has worked well for over 30 files, but this one is a mystery I cannot debug myself due to insufficient Au3 knowledge.
In line 11 "_Date_Time_FileTimeToArray" is called and for this particular file it sets the @error to 10. I don't know what that error code means, but it's not set by the _Date functions themselves I think.
Overall, it could be a problem caused by any of the functions below, how can I properly debug this? / Does anybody know a what's causing this?
_WinAPI_CreateFile() / _Date_Time_GetFileTime() / _Date_Time_FileTimeToArray()
Func _SetFileTimes($sFilePath) Local $monthNumber = ["", "January", "February", "March", "April", "May", "Juny", "July", "August", "September", "October", "November", "December"] Local $dayNumber = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] Local $fHandle = _WinAPI_CreateFile($sFilePath, 2, 2) ; read-only ; may NOT return a valid date for some reason! TODO Local $fTagFILETIME = _Date_Time_GetFileTime($fHandle) _WinAPI_CloseHandle($fHandle) ; This will return an empty array if theres no valid date $fModTime = _Date_Time_FileTimeToArray($fTagFILETIME) ; last Modified if @error <> 10 then Local $year = $fModTime Local $month = $fModTime Local $day = $fModTime Local $hour = $fModTime Local $min = $fModTime Local $sec = $fModTime Local $ms = $fModTime Local $weekday = $fModTime Global $prettyTimestamp = StringFormat("%s, %s %d, %04d %02d:%02d:%02d", $dayNumber[$weekday], $monthNumber[$month], $day, $year, $hour, $min, $sec) Global $uploadDate = StringFormat("%04d-%02d-%02d", $year, $month, $day) $fModTime = _Date_Time_FileTimeToArray(_Date_Time_FileTimeToLocalFileTime($fTagFILETIME)) ; last Modified Local $year = $fModTime Local $month = $fModTime Local $day = $fModTime Local $hour = $fModTime Local $min = $fModTime Local $sec = $fModTime Local $ms = $fModTime Local $weekday = $fModTime ; GetUnixTime accounts for Local time, hence feed it local time Global $unixTimestamp = _GetUnixTime($year &"/"& $month &"/"& $day &" "& $hour&":"& $min &":"& $sec) else Global $prettyTimestamp = "N/A" Global $uploadDate = "" Global $unixTimestamp = "N/A" endif endfunc
_GetUnixTime returned the year 1601 start date, showing that $fModTime is probably equal 0. (But Why?)
The file reports these dates in Explorer, it's on local NTFS drive:
Created: Wednesday, 31. Januar 2018, 18:55:02
Modified: Wednesday, 10. Januar 2018, 12:39:23
Accessed: Wednesday, 10. Januar 2018, 12:39:23
Ones(some times twice) a month I get an e-mail with zip file, which has price updates from a supplier.
I have to upload the file to an FTP to get it processed.
When uploading the file, it will get "timestamped" with the time and date at which time the file was uploaded.
Normally this is fine, because I mostly upload the file the same day.
Sometimes it may take 1 or 2 days before I can upload the file.
For historical purpose, I would like to have the file timestamped with the original date.
I have tried using: _FTP_Command ( $hFTPSession, "MFCT YYYYMMDDHHMMSS path")
however this command does not work or change the timestamp as I expected.
Does anyone now a way how I can change the timestamp of a FTP-file?
So what i need is a function that I pass a starting date into and it counts up to the current date. Example:
How would I do that? I found the Date.au3 in the includes but I can't find anything close to a time object like I'm used to working with in Java. I just need some $date = setDate(2009-05-30) and from there I could just add a day every time. I need this to be in the very format I stated earlier and from what I can see everytime related to date and time is automatically changed to my german locale.
€: I already tried setDate but instead it changed my PCs clock. Not quite what i was looking for
I have a question please
How to show Islamic date in Autoit
And moharam month ... etc
I hope my question is clear for you
Thanks in advance
So I get:
$aMatch Date(1499295600000) this is supposed to be 06 Jul 2017
$aMatch Date(1483574400000) this is supposed to be 05 Jan 2017
does anybody know the formula to calculate the date from the large number? It doesn't seem to be anything to do with DateToDayValue.
thanks in advance.