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

NameTypeRequiredDescription

date

date time

☑️

a date

format

text or formatstring

☑️

the format is used to specify how the date should be represented, text or a format string can be used.

language

text

☑️

this parameter is used to specify the date representation of that language

Format strings

Format nameExampleDescription

ShortDate

8-4-2022

day month and year in numbers.

ShortDateTime

8-4-2022 17:51

day, month, year and time in numbers

LongDate

vrijdag 8 april 2022

day of the week and month in text with the day and year in numbers.

LongDateTime

vrijdag 8 april 2022 17:51

day of the week and month in text with the day, year and time in numbers.

Iso8601

2022-04-08T17:51:38

date in the iso8601 standard

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