Skip to content

An object that sets default formatting for date and time fields based on the environment's locale.

Referenced by: fieldConfiguration, fieldInfo

Properties

Property Details
dateStyle A string value that implies the format for the date component of date fields or date-only fields. This property is a preset configuration of year, month, day and other date-specific properties and is based on the environment's locale. Take note that date format can be specified either via dateStyle, year, or as year + month. Take note that month cannot be set individually.
Valid values:
  • full
  • long
  • medium
  • short
hour12 A string value that indicates whether to show a 12-hour cycle when formatting time in either time-only fields or the time component of date fields. This automatically adjusts based on the environment's locale. Possible values are auto, never, and always. The default is auto and is locale dependent. Take note that this property is not applicable when the dateStyle's year + month is specified. Also, if timeStyle is not defined, this property is ignored/
Valid values:
  • always
  • auto
  • never
month A string value that indicates how the month should display. Possible values are short (e.g. Mar) and long (e.g. March). Use this property when the dateStyle is not sufficient. Take note that month cannot be set individually.
Valid values:
  • long
  • short
timeStyle A string value that implies the format for time-only fields, or the time component of date fields. It is based on the environment's locale with possible values of full, long, medium, and short. Take note that this property is not applicable when year + month is specified.
Valid values:
  • full
  • long
  • medium
  • short
type A string that indicates the type of formatting being used.
Valid value of this property date-time
year A string value that indicates how to represent the year. This value is always numeric. Use this property when the dateStyle is not sufficient.
Valid value of this property numeric

Can be one of the following:

Date formatting using both short date and medium time styles - Example

This shows both date and time based on the provided date style of short and time style of medium. Results display 10/12/24, 2:54:28 PM (using a locale set to en-US), and 12/10/2024, 14:54:28 (using a locale set to en-GB).

{
  "dateStyle": "short",
  "timeStyle": "medium",
  "hour12": "auto",
  "type": "date-time"
}

Date formatting using only year - Example

Formats the date showing only the year. Results display 2024

{
  "year": "numeric",
  "type": "date-time"
}

Date formatting using short date style, medium time styles, and 24 hour time - Example

This shows both date and time based on the provided date style of short and time style of medium with a 24 hour cycle. Results display 10/12/24, 14:54:28 (using a locale set to en-US), and 12/10/2024, 14:54:28 (using a locale set to en-GB).

{
  "dateStyle": "short",
  "timeStyle": "medium",
  "hour12": "never",
  "type": "date-time"
}

Date formatting using full date style - Example

Formats the date with the full date style. Results display Saturday, October 12, 2024 (using a locale set to en-US), and Saturday 12 October 2024 (using a locale set to en-GB).

{
  "dateStyle": "full",
  "type": "date-time"
}

Date formatting using long date style - Example

Formats the date with the long date style. Results display October 12, 2024 (using a locale set to en-US), and 12 October 2024 (using a locale set to en-GB).

{
  "dateStyle": "long",
  "type": "date-time"
}

Date formatting using medium date style - Example

Formats the date with the medium date style. Results display Oct 12, 2024 (using a locale set to en-US), and 12 Oct 2024 (using a locale set to en-GB).

{
  "dateStyle": "medium",
  "type": "date-time"
}

Date formatting using short date style - Example

Formats the date with the short date style. Results display 10/12/24 (using a locale set to en-US), and 12/10/2024 (using a locale set to en-GB).

{
  "dateStyle": "short",
  "type": "date-time"
}

Date formatting using full time style - Example

Formats the time with the full time style. Results display 2:54:28 PM Eastern Standard Time (using a locale set to en-US), and 14:54:28 Eastern Standard Time (using a locale set to en-GB).

{
  "timeStyle": "full",
  "type": "date-time"
}

Date formatting using long time style - Example

Formats the time with the long time style. Results display 2:54:28 PM EST (using a locale set to en-US), and 14:54:28 GMT-5 (using a locale set to en-GB).

{
  "timeStyle": "long",
  "type": "date-time"
}

Date formatting using medium time style - Example

Formats the time with the medium time style. Results display 2:54:28 PM (using a locale set to en-US), and 14:54:28 (using a locale set to en-GB).

{
  "timeStyle": "medium",
  "type": "date-time"
}

Date formatting using short time style - Example

Formats the time with the short time style. Results display 2:54 PM (using a locale set to en-US), and 14:54 (using a locale set to en-GB).

{
  "timeStyle": "short",
  "type": "date-time"
}

Date formatting using medium time style with 12 hour cycle - Example

Formats the time with the medium time style and 12 hour cycle. Results display 2:54:28 PM (using a locale set to en-US) and 02:54:28 pm (using a locale set to en-GB).

{
  "hour12": "always",
  "timeStyle": "medium",
  "type": "date-time"
}

Date formatting using medium time style with 24 hour cycle - Example

Formats the time with the medium time style and 24 hour cycle. Results display 14:54:28 (using a locale set to en-US), and 14:54:28 (using a locale set to en-GB).

{
  "hour12": "never",
  "timeStyle": "medium",
  "type": "date-time"
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.