# Format a date

{% hint style="info" %}
The following table defines the token substrings you can use in a date-time format pattern for the functions DATEPARSE(str, format) and DATEFORMAT(date, format).
{% endhint %}

You can define the `format` field by combining the tokens shown below.

## Usual format token

Examples below given for `2014-08-06T13:07:04.054` considered as a local time in America/New\_York

<table data-full-width="false"><thead><tr><th width="332">To display</th><th width="314">Use this token</th><th>Example</th></tr></thead><tbody><tr><td>year, unpadded</td><td>y</td><td><code>2014</code></td></tr><tr><td>two-digit year</td><td>yy</td><td><code>14</code></td></tr><tr><td>four- to six- digit year, pads to 4</td><td>yyyy</td><td><code>2014</code></td></tr><tr><td>month as an unpadded number</td><td>M</td><td><code>8</code></td></tr><tr><td>month as a padded number</td><td>MM</td><td><code>08</code></td></tr><tr><td>month as an abbreviated localized string</td><td>MMM</td><td><code>Aug</code></td></tr><tr><td>month as an unabbreviated localized string</td><td>MMMM</td><td><code>August</code></td></tr><tr><td>month as a single localized letter</td><td>MMMMM</td><td><code>A</code></td></tr><tr><td>day of the month, no padding</td><td>d</td><td><code>6</code></td></tr><tr><td>day of the month, padded to 2</td><td>dd</td><td><code>06</code></td></tr><tr><td>hour in 12-hour time, no padding</td><td>h</td><td><code>1</code></td></tr><tr><td>hour in 12-hour time, padded to 2</td><td>hh</td><td><code>01</code></td></tr><tr><td>hour in 24-hour time, no padding</td><td>H</td><td><code>13</code></td></tr><tr><td>hour in 24-hour time, padded to 2</td><td>HH</td><td><code>13</code></td></tr><tr><td>minute, no padding</td><td>m</td><td><code>7</code></td></tr><tr><td>minute, padded to 2</td><td>mm</td><td><code>07</code></td></tr><tr><td>second, no padding</td><td>s</td><td><code>4</code></td></tr><tr><td>second, padded to 2 padding</td><td>ss</td><td><code>04</code></td></tr><tr><td>fractional seconds, functionally identical to SSS</td><td>u</td><td><code>054</code></td></tr><tr><td>fractional seconds, between 0 and 99, padded to 2</td><td>uu</td><td><code>05</code></td></tr><tr><td>fractional seconds, between 0 and 9</td><td>uuu</td><td><code>0</code></td></tr><tr><td>millisecond, no padding</td><td>S</td><td><code>54</code></td></tr><tr><td>millisecond, padded to 3</td><td>SSS</td><td><code>054</code></td></tr></tbody></table>

## Advanced format token

Examples below given for `2014-08-06T13:07:04.054` considered as a local time in America/New\_York

<table><thead><tr><th width="276">To display</th><th width="170">Use this token</th><th>Example</th></tr></thead><tbody><tr><td>ordinal (day of year), unpadded</td><td>o</td><td><code>218</code></td></tr><tr><td>ordinal (day of year), padded to 3</td><td>ooo</td><td><code>218</code></td></tr><tr><td>quarter, no padding</td><td>q</td><td><code>3</code></td></tr><tr><td>quarter, padded to 2</td><td>qq</td><td><code>03</code></td></tr><tr><td>ISO week year, unpadded</td><td>kk</td><td><code>14</code></td></tr><tr><td>ISO week year, padded to 4</td><td>kkkk</td><td><code>2014</code></td></tr><tr><td>ISO week number, unpadded</td><td>W</td><td><code>32</code></td></tr><tr><td>ISO week number, padded to 2</td><td>WW</td><td><code>32</code></td></tr><tr><td>Local week year, unpadded</td><td>ii</td><td><code>14</code></td></tr><tr><td>Local week year, padded to 4</td><td>iiii</td><td><code>2014</code></td></tr><tr><td>Local week number, unpadded</td><td>n</td><td><code>32</code></td></tr><tr><td>Local week number, padded to 2</td><td>nn</td><td><code>32</code></td></tr><tr><td>day of the week, as number from 1-7 (Monday is 1, Sunday is 7)</td><td>E</td><td><code>3</code></td></tr><tr><td>day of the week, as an abbreviate localized string</td><td>EEE</td><td><code>Wed</code></td></tr><tr><td>day of the week, as an unabbreviated localized string</td><td>EEEE</td><td><code>Wednesday</code></td></tr><tr><td>day of the week, as a single localized letter</td><td>EEEEE</td><td><code>W</code></td></tr><tr><td>localized numeric date</td><td>D</td><td><code>9/4/2017</code></td></tr><tr><td>localized date with abbreviated month</td><td>DD</td><td><code>Aug 6, 2014</code></td></tr><tr><td>localized date with full month</td><td>DDD</td><td><code>August 6, 2014</code></td></tr><tr><td>localized date with full month and weekday</td><td>DDDD</td><td><code>Wednesday, August 6, 2014</code></td></tr><tr><td>localized time</td><td>t</td><td><code>9:07 AM</code></td></tr><tr><td>localized time with seconds</td><td>tt</td><td><code>1:07:04 PM</code></td></tr><tr><td>localized time with seconds and abbreviated offset</td><td>ttt</td><td><code>1:07:04 PM EDT</code></td></tr><tr><td>localized time with seconds and full offset</td><td>tttt</td><td><code>1:07:04 PM Eastern Daylight Time</code></td></tr><tr><td>localized 24-hour time</td><td>T</td><td><code>13:07</code></td></tr><tr><td>localized 24-hour time with seconds</td><td>TT</td><td><code>13:07:04</code></td></tr><tr><td>localized 24-hour time with seconds and abbreviated offset</td><td>TTT</td><td><code>13:07:04 EDT</code></td></tr><tr><td>localized 24-hour time with seconds and full offset</td><td>TTTT</td><td><code>13:07:04 Eastern Daylight Time</code></td></tr><tr><td>short localized date and time</td><td>f</td><td><code>8/6/2014, 1:07 PM</code></td></tr><tr><td>less short localized date and time</td><td>ff</td><td><code>Aug 6, 2014, 1:07 PM</code></td></tr><tr><td>verbose localized date and time</td><td>fff</td><td><code>August 6, 2014, 1:07 PM EDT</code></td></tr><tr><td>extra verbose localized date and time</td><td>ffff</td><td><code>Wednesday, August 6, 2014, 1:07 PM Eastern Daylight Time</code></td></tr><tr><td>short localized date and time with seconds</td><td>F</td><td><code>8/6/2014, 1:07:04 PM</code></td></tr><tr><td>less short localized date and time with seconds</td><td>FF</td><td><code>Aug 6, 2014, 1:07:04 PM</code></td></tr><tr><td>verbose localized date and time with seconds</td><td>FFF</td><td><code>August 6, 2014, 1:07:04 PM EDT</code></td></tr><tr><td>extra verbose localized date and time with seconds</td><td>FFFF</td><td><code>Wednesday, August 6, 2014, 1:07:04 PM Eastern Daylight Time</code></td></tr><tr><td>narrow offset</td><td>Z</td><td><code>+5</code></td></tr><tr><td>short offset</td><td>ZZ</td><td><code>+05:00</code></td></tr><tr><td>techie offset</td><td>ZZZ</td><td><code>+0500</code></td></tr><tr><td>abbreviated named offset</td><td>ZZZZ</td><td><code>EST</code></td></tr><tr><td>unabbreviated named offset</td><td>ZZZZZ</td><td><code>Eastern Standard Time</code></td></tr><tr><td>IANA zone</td><td>z</td><td><code>America/New_York</code></td></tr><tr><td>meridiem</td><td>a</td><td><code>AM</code></td></tr><tr><td>unix timestamp in seconds</td><td>X</td><td><code>1407287224</code></td></tr><tr><td>unix timestamp in milliseconds</td><td>x</td><td><code>1407287224054</code></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.commandersact.com/features/data-quality/data-cleansing/supported-transformation-functions/format-a-date.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
