Restored from previous forum. Originally posted by GPI.
Code: Select all
Procedure FileTimeToDate(*FT.FileTime)
st.systemtime
FileTimeToSystemTime_(*ft,st)
h=st\whour+1: If h=24 : h=0: EndIf
result=Date(st\wyear,st\wmonth,st\wday,h,st\wminute,st\wsecond)
If h=0 : result+86400 : EndIf ; ein tag hochzählen
ProcedureReturn result
EndProcedure
Procedure DateToFileTime(datum,*ft.filetime)
st.systemtime
h=Hour(datum)-1: If h=-1 : h=23:datum-86400 :EndIf ; ein Tag runterzählen
st\wyear=Year(datum):st\wmonth=Month(datum):st\wday=Day(datum):st\whour=H:st\wminute=Minute(datum):st\wsecond=Second(datum):st\wMilliseconds=0
SystemTimeToFileTime_(st,*ft)
EndProcedure
Procedure SetFileTime(file$,datum)
result=0
openbuff.ofstruct
openbuff\cbytes=SizeOf(ofstruct)
handle=OpenFile_(@file$,@openbuff,#OF_READWRITE)
If handle
st.systemtime
ft.filetime
DateToFileTime(datum,ft)
result=SetFileTime_(handle,0,0,ft)
_lclose_(handle)
EndIf
ProcedureReturn result
EndProcedure
Procedure GetFileTime(file$)
result=0
openbuff.ofstruct
openbuff\cbytes=SizeOf(ofstruct)
handle=OpenFile_(@file$,@openbuff,#OF_READWRITE)
If handle
st.systemtime
ft.filetime
GetFileTime_(handle,0,0,ft)
result=FileTimeToDate(ft)
_lclose_(handle)
EndIf
ProcedureReturn result
EndProcedure
a=Date(2003,03,04,09,12,16); note for FAT-System: 1,3,5,7... second is not possible
setfiletime("test.txt",a)
Debug FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss",a)
a=getfiletime("test.txt")
Debug FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss",a)