Date and Time Format Tokens for Analytics

Use these format tokens to specify date and time formats in reports.

Date Format Tokens Used in Analytics

Token Description

HH24

Displays hours in 24-hour format. For example, 1 PM = 13.

HH12

Displays the hour in 12-hour format. For example, 5 PM = 5.

HH

Displays the hour in 12-hour format. For example, 5 PM = 5.

AM

Displays the AM/PM indicator.

PM

Displays the AM/PM indicator (same function as AM).

MI

Displays the minutes as a two-digit number.

SS

Displays the seconds.

D

Displays the numeric day of the week with Sunday as zero. For example, Monday =1.

DD

Displays the numeric day of the month.

DDD

Displays the numeric day of the year. For example, April 7 = 97.

DY

Displays the three-letter abbreviation for the day of the week. For example, Monday = Mon.

DAY

Displays the full day name. For example, Monday.

WW

Displays the week of the year as a number. The week begins on a Sunday, so the first week (week 1) of a new year is the first week that contains a Sunday. For example, in 2015, the first Sunday was January 4th. This means that the dates January 1st through 3rd of 2015 are considered to part of the last week of the previous year. So, February 22, 2015 = 8.

WWW

Displays the full month name followed by the first date of the week. For example, Sunday July 27, 2008 = July 27. This can be useful to identify a week by its start date rather than simply seeing a number as provided with WW.

WEEKS

Rounds the entered date value to the beginning of the week, using Sunday as the start of the week. For example, Thursday July 16, 2009 = 07/12/2009.

This token can be used only with the date_add and date_trunc functions.

IWEEKS

Rounds the entered date value to the beginning of the week, using Monday as the start of the week. For example, Thursday July 16, 2009 = 07/13/2009.

This token can be used only with the date_add and date_trunc functions.

MM

Displays the month as a two-digit number. For example, November = 11.

MON

Displays the three-character abbreviated month name. For example, March = Mar.

MONTH

Displays the full month name. For example, March.

Q

Displays the numeric quarter of the year. For example, October 31 = 4.

YY

Displays the last two digits of the year. For example, 2008 = 08.

YYYY

Displays the four-digit year. For example, 2008.

YYYX

Displays the international four-digit year around the end of or beginning of the year. For example, December 31, 2008 = 2009. This is used in conjunction with WW such that all week grouping will consistently include 7 days even at the start and end of the calendar year. YYYX will return the Year for the week where Sunday is the first day of the week. For example, if grouping by Year/Week (WW), even though the dates January 1, 2015 through January 3, 2015 occur in 2015, since they are included with WW as being in week 52 (last week of 2014), YYYX will keep the year consistent and return 2014. If you are going to group by week using WW and want to include the Year number, use YYYX.

YYIX

Displays the international four-digit year. This is used in conjunction with IW such that all week groupings consistently include 7 days even at the start and end of the calendar year.YYIX will return the Year for the week where Monday is the first day of the week. For example, even though the dates December 29, 2014 through December 31, 2014 occur in 2014, since they are included with IW as being in week 1 (first week of 2015), YYIX will keep the year consistent and return 2015. If you are going to group by week using IW and want to include the Year number, use YYIX.

J

Displays the Julian date. For example, 2008-08-08 11:18:30 = 733627.

IW

Displays the international week of the year as a number. IW follows ISO 8601:1988 standards. The IW week begins on a Monday and ends on a Sunday. The first week (week 1) of a new year is the first week that contains four or more days in that year. For example, in 2015, January 1st was a Thursday. This means that the week beginning on Monday, December 29, 2014 contains 3 days in 2014 and 4 days in 2015. So, any dates in that time period will be week 1 (of the new year). For example, December 30, 2014= 01.

IWW

Displays the international full month name followed by the first date of the week. For example, Wednesday December 31, 2007 = December 31. This can be useful to identify a week by its start date rather than simply seeing a number as provided with IW.

Time Format Tokens Used in Analytics

Token Description

DD

Displays the number of days.

HH

Displays the number of hours.

MI

Displays the number of minutes.

SS

Displays the number of seconds.