Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Function PBMain() As Long
Local tempDirData As DirData, temp$, iResult As Long
Local ST As SystemTime, FT As FileTime
'get DirData provided by Dir$
temp$ = Dir$("time.txt", To tempDirData)
'just to see what is in it - 8-19-2011 on my PC
FileTimeToSystemTime(ByVal VarPtr(tempDirData.LastWriteTime), ST)
? FormatST(ST)
'pick a date to test against (I picked older date in this case)
Reset ST
temp$ = "08-18-2011"
ST.wMonth = Val(Parse$(temp$,"-",1))
ST.wDay = Val(Parse$(temp$,"-",2))
ST.wYear = Val(Parse$(temp$,"-",3))
SystemTimeToFileTime(ST, FT)
iResult = CompareFileTime(ByVal VarPtr(tempDirData.LastWriteTime), FT)
? Str$(iResult) '-1 older, 0 same, +1 newer)
End Function
Function FormatST(ST As SystemTime, Optional ByVal Flag24 As Long) As String '1=24 hr time 0=12 hr time
Function = Format$(ST.wMonth,"00") + "-" + Format$(ST.wDay,"00") + "-" + Format$(ST.wYear,"00") + " " _
+ Format$(IIf(Flag24=0 And (ST.wHour > 11), ST.wHour-12, ST.wHour),"00") + ":" _
+ Format$(ST.wMinute,"00") + ":" + Format$(ST.wSecond,"00") _
+ IIf$(Flag24, "",IIf$(ST.wHour > 10, " pm"," am"))
End Function
'gbs_00596
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm