Converts a date (numeric date) into Date acceptable by SQL, as in YYYY-MM-DD HH:MM
If parameter passed is blank, today's date is returned (DateinSQL function is combined here too).
This works in SQL and MySQL as tested as of 2022-07-07
Function Convert2SQLDate(RegularDate)
Convert2SQLDate = Year(date()) & "-" & Month(date()) & "-" & Day(date()) & " " & Hour(Now) & ":" & Minute(Now)
if RegularDate = "" then exit function
if not isdate(RegularDate) then exit function
Convert2SQLDate = Year(RegularDate) & "-" & right("00" & Month(RegularDate),2) & "-" & right("00" & Day(RegularDate),2)
End Function
Convert2SQLDate = Year(date()) & "-" & Month(date()) & "-" & Day(date()) & " " & Hour(Now) & ":" & Minute(Now)
if RegularDate = "" then exit function
if not isdate(RegularDate) then exit function
Convert2SQLDate = Year(RegularDate) & "-" & right("00" & Month(RegularDate),2) & "-" & right("00" & Day(RegularDate),2)
End Function
RegularDate
Views 4,175
Downloads 1,341
CodeID
DB ID
ANmarAmdeen
610
Revisions
v3.0
Thursday
July
7
2022