Example Use
formatDate("%Y-%m-%d %h:%i:%s %a",strDateToFormat)
Reference
Year
%Y – Last four digits of year eg: 2018 = 2018
%y – Last two digits of year eg: 2018 = 18
Month
format = replace(format, "%m", dateMonth)
format = replace(format, "%un", cint(dateMonth)-1)
format = replace(format, "%n", cint(dateMonth))
format = replace(format, "%F", getMonthName(cint(dateMonth),false))
format = replace(format, "%M", getMonthName(cint(dateMonth), true))
format = replace(format, "%d", dateDay)
format = replace(format, "%j", cint(dateDay))
date24hour = datehour
if Instr(lcase(format),"%a")>0 then
if (cint(dateHour)>11) then
A = "PM"
dateHour = right("0" & cstr(cint(dateHour)-12),2)
if dateHour = "00" then dateHour = "12"
else
A = "AM"
end if
else
if instr(lcase(intTimeStamp),"am")=0 AND instr(lcase(intTimeStamp),"pm")=0 then
A = "AM"
else
if instr(lcase(intTimeStamp),"am")>0 then
A = "AM"
else
A = "PM"
end if
end if
end if
format = replace(format, "%A", A)
format = replace(format, "%a", lcase(A))
format = replace(format, "%H", dateHour)
format = replace(format, "%h", date24Hour)
format = replace(format, "%G", cint(dateHour))
format = replace(format, "%g", cint(date24Hour))
format = replace(format, "%i", dateMinute)
format = replace(format, "%I", cint(dateMinute))
format = replace(format, "%s", dateSecond)
format = replace(format, "%S", cint(dateSecond))
format = replace(format, "%L", WeekDay(unUDate))
format = replace(format, "%D", left(WeekDayName(WeekDay(unUDate)), 3))
format = replace(format, “%l", WeekDayName(WeekDay(unUDate)))
format = replace(format, "%U", intTimeStamp)
format = replace(format, "11%O", "11th")
format = replace(format, "1%O", "1st")
format = replace(format, "12%O", "12th")
format = replace(format, "2%O", "2nd")
format = replace(format, "13%O", "13th")
format = replace(format, "3%O", "3rd")
format = replace(format, "%O", "th")