Convert2SQLDate

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

CodeFunctionName
What is this?

Public

Tested

Original Work
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

RegularDate

Views 4,163

Downloads 1,337

CodeID
DB ID

ANmarAmdeen
604
Attachments
Revisions

v3.0

Thursday
July
7
2022