FormatDate

The FormatDate() function converts a date to a specified format.

Typical elements that can be used in the date format: yyyy: full year; MM: month number with leading zero; dd: day-number with leading zero; HH: 24-hour time with leading zero; h: 12-hour time without leading zero; mm: minutes with leading zero; ss: seconds with leading zero; fff: fraction of a second (milliseconds in this case).

See the [Microsoft documentation] (https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx) to learn more about format strings.

This function is NOT SQL compatible. For more information about SQL compatibility, see our documentation.

Returns a new text string that is the text representation of a date. Returns Invalid expression if Dateis unknown or the indicated format is not valid for dates.

Syntax

FormatDate(date,format)

FormatDate(Now(), "MM-dd-yyyy") => "05-13-2022"

FormatDate(date,language)

FormatDate(Now(), en_US) => "5/13/2022 01:54:00 PM"

Parameters

Format strings

When using a format string, the separator and order of your date is dependent on your date settings. You can find and change this setting per portal, see more about portal and language settings here.

If the format or language parameter contains an unknown value, then the default portal language is used to format the string.

Last updated