Menu
Amazon QuickSight
User Guide

extract Function

extract returns a specified portion of a date value. Requesting a time-related portion of a date that doesn't contain time information returns 0.

Syntax

Copy
extract('period', date)

Arguments

period

The period that you want extracted from the date value. Valid periods are as follows:

  • YYYY: This returns the year portion of the date.

  • MM: This returns the month portion of the date.

  • DD: This returns the day portion of the date.

  • WD: This returns the day of the week as an integer, with Sunday being 0.

  • HH: This returns the hour portion of the date.

  • MI: This returns the minute portion of the date.

  • SS: This returns the second portion of the date.

date

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

Return Type

Integer

Example

The following example extracts the day of the week from a date value.

Copy
extract('DD', {order date})

For the field values:

Copy
order date ========= 01/01/14 09/13/16

The following values are returned:

Copy
01 13