Get FileDate?

BlitzMax Forums/BlitzMax Programming/Get FileDate?

Grisu(Posted 2009) [#1]
Hi!

FileSize, FileTime and FileType are already there.

What about a cross-platform! FileDate function, that gets the file date (= when the file was last modified)?

I'd love to create a filelist that is sorted by date.
Was kind of shocked that this basic function is missing. :(

Thanks
Grisu


degac(Posted 2009) [#2]

Function FileTime( path$ )
Returns The time the file at path was last modified
Description Get file time


What I'm missing?


Grisu(Posted 2009) [#3]
The function returns "1253448532" for instance.

So how can I tansform this into "20.09.2009" + "19:16"?

From my understanding the term "time" differs from "date".


degac(Posted 2009) [#4]
Ah! Ok, it returns UNIX time...

See this http://www.blitzbasic.com/Community/posts.php?topic=84517#956389

Print FileTimeWithFormat("C:\blitzmax134\versions.txt","%d %b %Y %H:%M:%S")
Function FileTimeWithFormat:String(path:String, format:String)
	Local time:Int Ptr, buff:Byte[256], ftime:Int
	
	ftime = FileTime(path)
	time = Varptr(ftime)
	strftime_(buff, 256, format, localtime_(time))
	
	Return String.FromCString(buff)
	
End Function

I hope in an 'update' too with CurrentDate()!