Skip to main content
Attribution: The content of this article came from a member of the Domo Community Forums. We are indebted to our outstanding community for their enthusiasm, expertise, and championship of Domo. View the original post .Visit the Community Forums .

Intro

Properly formatted dates and timestamps are needed to present data accurately and help provide insightful analysis. In Analyzer, the patterns for custom date formatting are based on the DateTimeFormatter class in Java. This article provides specific examples that you can use with your data. All examples are based on the following timestamp: Tuesday, March 14, 2023 03:09:26 PM

Examples

Description

Format

Example

Full date with day of the week, month, day, year, timestamp in 12-hour AM/PM format, and AM/PM distinction

EEEE, MMMM dd, yyyy hh:mm:ss a

Tuesday, March 14, 2023 03:09:26 PM

Full date with day of the week, month, day, and year

EEEE, MMMM dd, yyyy

Tuesday, March 14, 2023

Date and time

yyyy-MM-dd HH:mm:ss

2023-03-14 15:09:26

Short date format

MM/dd/yyyy

03/14/2023

Year and month

yyyy-MM

2023-03

Abbreviated day of the week and short month name

E, MMMM, dd

Tue, Mar 14

Custom pattern for day of the week, day, month, and year

E, dd MMMM yyyy

Tue, 14 Mar 2023

Key

Date Shorthand

  • L (equivalent to “Date Shorthand” date format) (Ex: 03/14/2023)
Day of Week
  • e: Localized day of week (Ex: 2)
  • E: Short-hand day of week (Ex: Tue)
  • EEEE: Full day of week (Ex: Tuesday)

Day

  • d: Day in one or two digits (Ex: 14, or 5 if the date was March 5th)
  • D or dd: Day in two digits (Ex: 14 or 05 if the date was March 5th)

Month

  • M: Month in one digit (Ex: 3)
  • MM: Month in two digits (Ex: 03)

Year

  • y: Year in two digits (Ex: 23 )
  • Y or yyyy: Year in four digits (Ex: 2023 )

Hour

  • HH: Hour in 24-hour AM/PM format in two digits (Ex: 15, since 3 hours after 12pm is 3pm)
  • k: Hour in 24-hour AM/PM format (Ex: 15)
  • hh: Hour in 12-hour AM/PM format in two digits (Ex: 03)
  • h: Hour in 12-hour AM/PM format in one digit (Ex: 3)

Minute

  • m: Minute in one or two digits (Ex: 9)
  • mm: MInute in two digits (Ex: 09)

Second

  • s: Second of a minute in one or two digits (Ex: 26, or 9 if the timestamp was 03:09:09 PM)
  • ss: Second of a minute in two digits (Ex: 26 or 09 if the timestamp was 03:09:09 PM)
  • S: Fraction of a second (Ex: 246 if the millisecond part of the timestamp 03/14/2023 03:09:26 PM was 246)

AM vs. PM

  • a: AM or PM in timestamp in lower case (Ex: pm)
  • A: AM or PM in timestamp in upper case (Ex: PM)

Offsets

  • X: Unix timestamp (Ex: 1678824566, since 1,678,824,566 seconds have elapsed since January 1, 1970 00:00:00 UTC [the Unix epoch] given that the timestamp is March 14, 2023 03:09:26 PM in CST)