> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# DateFormat

The **DateFormat** function evaluates a date value and extracts datetime components (as text strings) in the specified format.

## Syntax

```
DateFormat(date, format)
```

### Function arguments:

|            |                                                                              |
| :--------- | :--------------------------------------------------------------------------- |
| **date**   | (required) The date or column of date values to evaluate.                    |
| **format** | (required) The datetime components (as a datetime format string) to extract. |

### Compatible format specifiers

The **DateFormat** function uses the datetime formatting functionality of the connected data platform. The following format specifiers are supported by most connections and can be used to build the datetime format string. If a specifier does not return the expected results, consult the documentation of your connected data platform for more information.

<table>
  <thead>
    <tr>
      <th>
        Format
      </th>

      <th>
        Description
      </th>

      <th>
        Example output

        <br />

        <em>(for 2018-07-08 00:34:59)</em>
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        <p>%Y</p>
      </td>

      <td>
        <p>Four-digit year</p>
      </td>

      <td>
        <p>2018</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%y</p>
      </td>

      <td>
        <p>Two-digit year</p>
      </td>

      <td>
        <p>18</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%q</p>
      </td>

      <td>
        <p>Quarter of the year (1–4)</p>
      </td>

      <td>
        <p>3</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%m</p>
      </td>

      <td>
        <p>Two-digit month</p>
      </td>

      <td>
        <p>07</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%B</p>
      </td>

      <td>
        <p>Full month name</p>
      </td>

      <td>
        <p>July</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%b</p>
      </td>

      <td>
        <p>Abbreviated month name</p>
      </td>

      <td>
        <p>Jul</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%A</p>
      </td>

      <td>
        <p>Full day of week</p>
      </td>

      <td>
        <p>Sunday</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%a</p>
      </td>

      <td>
        <p>Abbreviated day of week</p>
      </td>

      <td>
        <p>Sun</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%d</p>
      </td>

      <td>
        <p>Two-digit day of month (01-31)</p>
      </td>

      <td>
        <p>08</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%H</p>
      </td>

      <td>
        <p>Two-digit hour based on 24-hour clock (00–23)</p>
      </td>

      <td>
        <p>00</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%I</p>
      </td>

      <td>
        <p>Two-digit hour based on 12-hour clock (01–12)</p>
      </td>

      <td>
        <p>12</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%M</p>
      </td>

      <td>
        <p>Two-digit minutes (00–59)</p>
      </td>

      <td>
        <p>34</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%S</p>
      </td>

      <td>
        <p>Two-digit seconds (00–59)</p>
      </td>

      <td>
        <p>59</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%p</p>
      </td>

      <td>
        <p>AM or PM</p>
      </td>

      <td>
        <p>AM</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%L</p>
      </td>

      <td>
        <p>Three-digit milliseconds (000–999)</p>
      </td>

      <td>
        <p>000</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%f</p>
      </td>

      <td>
        <p>Six-digit microseconds (000000–999999)</p>
      </td>

      <td>
        <p>000000</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%Z</p>
      </td>

      <td>
        <p>Time zone offset</p>
      </td>

      <td>
        <p>-07:00</p>
      </td>
    </tr>

    <tr>
      <td>
        <p>%%</p>
      </td>

      <td>
        <p>Percent symbol</p>
      </td>

      <td>
        <p>%</p>
      </td>
    </tr>
  </tbody>
</table>

## Examples

### Example 1

```
DateFormat(Date("2018-07-23"), "%B")
```

Evaluates the date value `"2018-07-23"` and returns the full month name, `July`.

### Example 2

```
DateFormat([Date], "%a, %B %d, %Y")
```

Evaluates date values in the *Date* column and returns text strings formatted to include the abbreviated weekday name, full month name, two-digit day of the month, and four-digit year, with commas following the weekday name and day of the month.

![In a column with Date and DateFormat, several dates in the format 'YYYY-MM-DD' are formatted to abbreviated weekday, full month, two-digit date, and four-digit year. For example, 2024-04-08 becomes Mon, April 08, 2024](https://files.buildwithfern.com/sigma.docs.buildwithfern.com/2576ac246ed36b322c1ecc2bca8da1b89451e48f51c2b16601dff0e2331f7147/assets/docs-images/a8cdf5b-image.png)

## Related resources

* [Date functions overview](/docs/date-functions-overview)
* <a href="https://quickstarts.sigmacomputing.com/guide/common_date_functions/index.html" target="_blank" rel="noopener noreferrer">
    Quickstart: Common date functions and use cases
  </a>