Pre-Defined Date and Time formats for the FORMAT Function (DAX)

The following table identifies the predefined date and time format names.

Format specification

Description

"General Date", or "G"

Displays a date and/or time. For example, 3/12/2008 11:07:31 AM. Date display is determined by your application's current culture value.

"Long Date", "Medium Date", or "D"

Displays a date according to your current culture's long date format. For example, Wednesday, March 12, 2008.

"Short Date", or "d"

Displays a date using your current culture's short date format. For example, 3/12/2008.

The d character displays the day in a user-defined date format. For more information, see User-Defined Date/Time Formats (Format Function).

"Long Time", "Medium Time", or "T"

Displays a time using your current culture's long time format; typically includes hours, minutes, seconds. For example, 11:07:31 AM.

"Short Time" or "t"

Displays a time using your current culture's short time format. For example, 11:07 AM.

The t character displays AM or PM values for locales that use a 12-hour clock in a user-defined time format. For more information, see User-Defined Date/Time Formats (Format Function).

"f"

Displays the long date and short time according to your current culture's format. For example, Wednesday, March 12, 2008 11:07 AM.

"F"

Displays the long date and long time according to your current culture's format. For example, Wednesday, March 12, 2008 11:07:31 AM.

"g"

Displays the short date and short time according to your current culture's format. For example, 3/12/2008 11:07 AM.

"M", "m"

Displays the month and the day of a date. For example, March 12.

The M character displays the month in a user-defined date format. The m character displays the minutes in a user-defined time format. For more information, see User-Defined Date/Time Formats (Format Function).

"R", "r"

Formats the date according to the RFC1123Pattern property. For example, Wed, 12 Mar 2008 11:07:31 GMT. The formatted date does not adjust the value of the date and time. You must adjust the Date/Time value to GMT before calling the Format function.

"s"

Formats the date and time as a sortable index. For example, 2008-03-12T11:07:31.

The s character displays the seconds in a user-defined time format. For more information, see User-Defined Date/Time Formats (Format Function).

"u"

Formats the date and time as a GMT sortable index. For example, 2008-03-12 11:07:31Z.

"U"

Formats the date and time with the long date and long time as GMT. For example, Wednesday, March 12, 2008 6:07:31 PM.

"Y", "y"

Formats the date as the year and month. For example, March, 2008.

The Y and y characters display the year in a user-defined date format. For more information, see User-Defined Date/Time Formats (Format Function).

Remarks

Formatting strings are case sensitive. Different formatting can be obtained by using a different case. For example, when formatting a date value with the string "D" you get the date in the long format (according to your current locale). However, if you change the case to "d" you get the date in the short format. Also, unexpected results or an error might occur if the intended formatting does not match the case of any defined format string.