Menu
Amazon QuickSight
User Guide

formatDate Function

formatDate formats a date using a pattern you specify.

Syntax

Copy
formatDate(date, ['format'], ['time_zone'])

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 do not specify a format, it will default to yyyy-MM-ddTkk:mm:ss:SSS.

time_zone

(Optional) A string representing an IANA time zone.

If you do not specify a time zone, UTC is used.

Return Type

String

Example

The following example formats a UTC date and displays using a specific time zone.

Copy
formatDate({order date}, 'dd MMM yyyy', 'America/Los_Angeles')

The following are the given field values.

Copy
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.

Copy
13 Dec 2012 28 Dec 2013 14 Nov 2012