How to get file date?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Tecor400.

Hi,
I have not found in PB documentation any command who allows to retreive the date of a file.

Somebody can help me?

BR
Joaquin
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pupil.

Use Win API command for this. Something like this should do it(you might have to correct some stuff, as i haven't tested it yet):

Code: Select all

hFile.l = ReadFile(0, "Your file to open")
If hFile
  If GetFileTime_(hFile, @creationtime.FILETIME, @lastaccestime.FILETIME, lastwritetime.FILETIME)
    FileTimeToSystemTime_(@creationtime, @time.SYSTEMTIME)
    ; the structure SYSTEMTIME contains year, month, day, hour, minute, second, millisecond
    ; Recently someone wrote a snippet to interpret this info see att Resoures site or
    ; this forum for more info about that.
  EndIf
  CloseFile(0)
EndIf
You really should get a Win API helpfile to be able to digest this properly, on the resources site there's some links that might help i think..
Resources site: http://www.reelmediaproductions.com/pb/

Hope this info will help you...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Tecor400.



It runs fine.
Thanks

BR
Joaquin
Post Reply