formatDate - Amazon QuickSight

formatDate

formatDate formats a date using a pattern you specify. When you are preparing data, you can use formatDate to reformat the date. To reformat a date in an analysis, you choose the format option from the context menu on the date field.

Syntax

formatDate(date, ['format'])

Arguments

date

A date field or a call to another function that outputs a date.

format

(Optional) A string containing the format pattern to apply. This argument accepts the format patterns specified in Supported Date Formats.

If you don't specify a format, this string defaults to yyyy-MM-ddTkk:mm:ss:SSS.

Return Type

String

Example

The following example formats a UTC date.

formatDate(orderDate, 'dd MMM yyyy')

The following are the given field values.

order date ========= 2012-12-14T00:00:00.000Z 2013-12-29T00:00:00.000Z 2012-11-15T00:00:00.000Z

For these field values, the following values are returned.

13 Dec 2012 28 Dec 2013 14 Nov 2012