Sqldate validate

Hey All !
Is there a system to validate a sqldate or sqldatetime ( no locale setting ) ?

if yes…
i’m going to calculate datediff from date to now


dim controldate as string = "2018-03-10 19:12:01" // sqldatetime 
dim datenow as new date // now
dim datelast as new date
datelast.sqldatetime = controldate

if datediff(datenow,datelast) > 30 then 
   msgbox("Expired")
end if

/// 
function datediff(datafinale, datafinale) as integer 
dim secsInDay as Double = 3600.0*24.0
dim diff as Double = datafinale.TotalSeconds - datainiziale.TotalSeconds
diff = diff / secsInDay

#if TargetWindows  // fix a windows problem, steal me a day 
  diff = diff + 1
#endif

return diff

datelast.sqldatetime = controldate

that line validates it for you… if it is a non valid date string you get an exception error

sometimes the solution is simpler than the question …
Thanks! Dave.