Validate Date - API Method

Category: Time/Timers

Date: 02-16-2022

Return to Index


 
'Compilable Example:  (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
 
Function PBMain() As Long
   Local st As SYSTEMTIME, ft As FILETIME, sDate$,m$,d$,y$, iResult As Long
   sDate$ = "01-01-201x"
   M$ = Parse$(sDate$,"-",1)
   D$ = Parse$(sDate$,"-",2)
   Y$ = Parse$(sDate$,"-",3)
   st.wYear = Val(Y$)
   st.wMonth =  Val(M$)
   st.wDay    =  Val(D$)
   iResult = SystemTimeToFileTime(st, ft)
   If iResult Then ? "Valid DateElse ? "Invalid Date"
End Function
 
'gbs_00735
'Date: 03-10-2012


created by gbSnippets
http://www.garybeene.com/sw/gbsnippets.htm