Show Menu
TOPICS×

Date Formats

You can define the date formats that are used when it parses and indexes any field with a "date" data type.
The format of the date and time is specified with a format string. The format string consists of zero or more conversion specifications (a conversion specification consists of a percent sign and one other character) and ordinary characters. A default list is provided of date format strings for each date field.
You have complete control over this list and may add to or modify it to suit your site's needs. The top format string takes precedence and subsequent format strings are only used if parsing a given metadata tag's content yields an error.
For example, suppose you have specified the following date formats:
%B %d, %Y %T %Z
%b %d, %Y %T %Z
%A %B %d, %Y %T %Z
%A %b %d, %Y %T %Z
%a %B %d, %Y %T %Z
%a %b %d, %Y %T %Z
%d %b %Y %T %Z
The first format, "%B %d, %Y %T %Z", matches dates like the following "September 20, 2014 13:12:00 PDT". If the metadata tag content cannot be parsed with this format string, the next available format "%b %d, %Y %T %Z" is tried. This format matches dates like the following: "Sep 20, 2014 3:12:00 PDT". If the metadata tag content cannot be parsed with this format string, site search/merchandising moves down the list of format strings until it finds a format string that works.
The following table describes the available date format strings:
Data format
Description
%A
Matches the national representation of the full weekday name, for example, "Monday." The national representation is determined from the "Language" setting on the "Words & Languages" Option
%a
matches the national representation of the abbreviated weekday name, where the abbreviation is the first three characters, e.g. "Mon." The national representation is determined from the "Language" setting on the "Words & Languages" Option
%B
matches the national representation of the full month name, e.g. "June." The national representation is determined from the "Language" setting on the "Words & Languages" Option
%b
matches the national representation of the abbreviated month name, where the abbreviation is the first three characters, e.g. "Jun." The national representation is determined from the "Language" setting on the "Words & Languages" Option
%D
is equivalent to "%m/%d/%y", e.g. "06/06/01"
%d
matches the day of the month as a decimal number (01-31)
%e
matches the day of month as a decimal number (1-31); single digits are preceded by a blank
%H
matches the hour (24-hour clock) as a decimal number (00-23)
%h
matches the national representation of the abbreviated month name, where the abbreviation is the first three characters, e.g. "Jun" (the same as %b)
%I
matches the hour (12-hour clock) as a decimal number (01-12)
%j
matches the day of the year as a decimal number (001-366)
%k
matches the hour (24-hour clock) as a decimal number (0-23); single digits are preceded by a blank
%l
matches the hour (12-hour clock) as a decimal number (1-12); single digits are preceded by a blank
%M
matches the minute as a decimal number (00-59)
%m
matches the month as a decimal number (01-12)
%p
matches the national representation of either "ante meridiem" or "post meridiem" as appropriate, e.g. "PM." The national representation is determined from the "Language" setting on the "Words & Languages" Option
%R
is equivalent to "%H:%M", e.g. "13:23"
%r
is equivalent to "%I:%M:%S %p", e.g. "01:23:45 PM"
%S
matches the second as a decimal number (00-60)
%T
is equivalent to "%H:%M:%S", e.g. "13:26:47"
%U
matches the week number of the year (Sunday as the first day of the week) as a decimal number (00-53)
%v
is equivalent to "%e-%b-%Y", e.g. "6-Jun-2001"
%Y
matches the year with century as a decimal number, e.g. "2001"
%y
matches the year without century as a decimal number (00-99)
%Z
matches the time zone name
%%
matches "%"
Default Format Strings
The following default format strings are used by templates. You can add to this list or edit it as necessary.
Default format string
Resulting example
%B %d, %Y %T %Z
September 5, 1999 13:12:00 PDT
%b %d, %Y %T %Z
Sep 5, 1999 13:12:00 PDT
%A %B %d, %Y %T %Z
Sunday September 5, 1999 13:12:00 PDT
%A %b %d, %Y %T %Z
Sunday Sep 5, 1999 13:12:00 PDT
%a %B %d, %Y %T %Z
Sun September 5, 1999 13:12:00 PDT
%a %b %d, %Y %T %Z
Sun Sep 5, 1999 13:12:00 PDT
%d %b %Y %T %Z
5 Sep 1999 13:12:00 PDT