---
schema_version: "1"
id: d644f5c5df175304595c7a2637630526138bcd8a3ae41ff7dd4980efa9d4f372
title: Omnistudio Date and Time Functions
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_omnistudio_date_and_time_functions.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: e4816c27283b817e205f295b237d9c9995af3d070e2c3643894bd8a0ec9fb2b5
description: Functions that operate on dates and times.
products:
  - Omnistudio
release: "264"
---
# Omnistudio Date and Time Functions

Functions that operate on dates and times.

- **[Omnistudio ADDDAY Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns a date and time after adding a specified number of days.
- **[Omnistudio ADDMONTH Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns a date and time after adding a specified number of months.
- **[Omnistudio ADDYEAR Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns a date and time after adding a specified number of years.
- **[Omnistudio AGE Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the age in years for a specified birth date.
- **[Omnistudio AGEON Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the age in years for a specified birth date on a specified date.
- **[Omnistudio DATEDIFF Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the difference in number of days between two specified dates as an integer value.
- **[Omnistudio DATETIMETOUNIX Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the number of milliseconds in UNIX time for a specified date and time.
- **[Omnistudio DAY Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the day for a specified date as an integer value.
- **[Omnistudio EOM Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the date and time of the last day of the month for a specified date.
- **[Omnistudio FORMATDATETIME Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns a date and time as a string in a specified format and time zone.
- **[Omnistudio FORMATDATETIMEGMT Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns a date and time as a string in a specified format and in the GMT time zone.
- **[Omnistudio HOUR Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the hour for a specified time as an integer value.
- **[Omnistudio MINUTE Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the minute for a specified time as an integer value.
- **[Omnistudio MONTH Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the month for a specified date as an integer value.
- **[Omnistudio NOW Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the current date and time in a specified format.
- **[Omnistudio SECOND Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the second for a specified time as an integer value.
- **[Omnistudio TIMEDIFF Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the difference in number of milliseconds between two specified times as an integer.
- **[Omnistudio TODAY Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the current date.
- **[Omnistudio UNIXTODATETIME Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the date and time for a number of seconds or milliseconds specified in UNIX time.
- **[Omnistudio YEAR Function](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_date_and_time_functions.htm&release=264.0.0&type=5)**  
    Returns the year for a specified date as an integer value.

## Omnistudio ADDDAY Function

Returns a date and time after adding a specified number of days.

If you specify a date and time, use the date format `"YYYY-MM-DD"` to preserve the input time. Use the date format `"MM/DD/YYYY"` to reset the time to `00:00:00`.

### Signature

`ADDDAY(date, days)`

### Return Value

Datetime

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e278">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e284">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e290">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e296">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e278 ">
                  <p style="margin-bottom:0;"><code><var>date</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e284 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e290 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e296 ">
                  <p style="margin-bottom:0;">A date specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e278 ">
                  <p style="margin-bottom:0;"><code><var>days</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e284 ">
                  <p style="margin-bottom:0;">Integer</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e290 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e296 ">
                  <p style="margin-bottom:0;">The number of days to be added to the specified date. Use a negative number
                    to subtract days from the date.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Add Days Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Add Days Example

Formula: `ADDDAY("2025-01-01", 31)`

Formula: `ADDDAY("01/01/2025", 31)`

Formula: `ADDDAY("01/01/2025T12:00:00Z", 31)`

Return value: `"2025-02-01T00:00:00.000Z"`

![Add Days Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Add Days Example

Formula: `ADDDAY("2025-01-01T12:00:00Z", 31)`

Return value: `"2025-02-01T12:00:00.000Z"`

![Subtract Days Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Subtract Days Example

Formula: `ADDDAY("2025-01-01", -100)`

Formula: `ADDDAY("2025-01-01T00:00:00Z", -100)`

Return value: `"2024-09-23T00:00:00.000Z"`

## Omnistudio ADDMONTH Function

Returns a date and time after adding a specified number of months.

If you specify a date and time, use the date format `"YYYY-MM-DD"` to preserve the input time. Use the date format `"MM/DD/YYYY"` to reset the time to `00:00:00`.

### Signature

`ADDMONTH(date, months)`

### Return Value

Datetime

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e514">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e520">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e526">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e532">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e514 ">
                  <p style="margin-bottom:0;"><code><var>date</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e520 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e526 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e532 ">
                  <p style="margin-bottom:0;">A date specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e514 ">
                  <p style="margin-bottom:0;"><code><var>months</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e520 ">
                  <p style="margin-bottom:0;">Integer</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e526 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e532 ">
                  <p style="margin-bottom:0;">The number of months to be added to the specified date. Use a negative number
                    to subtract months from the date.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Add Months Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Add Months Example

Formula: `ADDMONTH('2025-25-01', 15)`

Formula: `ADDMONTH("01/25/2025", 15)`

Formula: `ADDMONTH("01/25/2025T16:35:30Z", 15)`

Return value: `"2026-04-25T00:00:00.000Z"`

![Add Months Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Add Months Example

Formula: `ADDMONTH("2025-01-25T16:35:30Z", 15)`

Return value: `"2026-04-25T16:35:30.000Z"`

![Subtract Months Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Subtract Months Example

Formula: `ADDMONTH("01/25/2025", -15)`

Formula: `ADDMONTH('01/25/2025T16:35:30Z', -15)`

Return value: `"2023-10-25T00:00:00.000Z"`

## Omnistudio ADDYEAR Function

Returns a date and time after adding a specified number of years.

If you specify a date and time, use the date format `"YYYY-MM-DD"` to preserve the input time. Use the date format `"MM/DD/YYYY"` to reset the time to `00:00:00`.

### Signature

`ADDYEAR(date, years)`

### Return Value

Datetime

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e751">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e757">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e763">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e769">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e751 ">
                  <p style="margin-bottom:0;"><code><var>date</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e757 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e763 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e769 ">
                  <p style="margin-bottom:0;">A date specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e751 ">
                  <p style="margin-bottom:0;"><code><var>years</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e757 ">
                  <p style="margin-bottom:0;">Integer</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e763 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e769 ">
                  <p style="margin-bottom:0;">The number of years to be added to the specified date. Use a negative number
                    to subtract years from the date.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Add Years Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Add Years Example

Formula: `ADDYEAR("2025-01-01", 10)`

Formula: `ADDYEAR("01/01/2025", 10)`

Formula: `ADDYEAR("01/01/2025T16:35:30", 10)`

Return value: `"2035-01-01T00:00:00.000Z"`

![Add Years Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Add Years Example

Formula: `ADDYEAR("2025-01-01T16:35:30", 10)`

Return value: `"2035-01-01T16:35:30.000Z"`

![Subtract Years Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Subtract Years Example

Formula: `ADDYEAR("2025-01-01", -10)`

Formula: `ADDYEAR("2025-01-01T00:00:00", -10)`

Return value: `"2015-01-01T00:00:00.000Z"`

## Omnistudio AGE Function

Returns the age in years for a specified birth date.

### Signature

`AGE(birthDate)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e969">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e975">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e981">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e987">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e969 ">
                  <p style="margin-bottom:0;"><code><var>birthDate</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e975 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e981 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e987 ">
                  <p style="margin-bottom:0;">A date specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Date String Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date String Example

Formula: `AGE("02/15/2002")`

Formula: `AGE("2002-02-15")`

Return value: `23`

![Date and Time String Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time String Example

Formula: `AGE("2002-02-15T16:35:30")`

Formula: `AGE("2002-02-15T16:35:30Z")`

Return value: `23`

## Omnistudio AGEON Function

Returns the age in years for a specified birth date on a specified date.

The function calculates an age based only on dates; it ignores times. The function returns `0` if the specified `date` is less than a year from or is earlier than the `birthDate`.

### Signature

`AGEON(birthDate, date)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1156">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1162">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1168">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1174">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1156 ">
                  <p style="margin-bottom:0;"><code><var>birthDate</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1162 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1168 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1174 ">
                  <p style="margin-bottom:0;">The birth date for which the age is to be calculated. Specify a date as a string in
                    <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js
                      format</a>. You can specify a date and time.
                  </p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1156 ">
                  <p style="margin-bottom:0;"><code><var>date</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1162 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1168 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1174 ">
                  <p style="margin-bottom:0;">A date for which the function is to calculate an age based on the birth date. Specify a
                    date as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Date and Time String Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time String Example

Formula: `` `AGEON("02/15/2002T16:35:30Z", "2030-02-28")` ``

Formula: `` `AGEON("2002-02-15", "2030-02-28T16:35:30Z")` ``

Return value: `28`

![JSON Object Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

JSON Object Example

Sample data:

```
"BirthDate": "6/25/2004T09:05:00 GMT -0500 (EDT)"
"FutureDate1": "02/28/2030",
"FutureDate2": "2030-02-28"
```

Formula: `` `AGEON(%Birthdate%, %FutureDate1%)` ``

Formula: `` `AGEON("BirthDate%, %FutureDate2%)` ``

Return value: `25`

## Omnistudio DATEDIFF Function

Returns the difference in number of days between two specified dates as an integer value.

The first date is subtracted from the second date. If the first date is greater than the second date, the function returns a negative integer.

If you include a time, the function considers it in its calculation. If you specify a time zone, the function considers it in its calculation.

### Signature

`DATEDIFF(firstDate, secondDate)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1380">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1386">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1392">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1398">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1380 ">
                  <p style="margin-bottom:0;"><code><var>firstDate</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1386 ">
                  <p style="margin-bottom:0;">Date</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1392 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1398 ">
                  <p style="margin-bottom:0;">A date specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1380 ">
                  <p style="margin-bottom:0;"><code><var>secondDate</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1386 ">
                  <p style="margin-bottom:0;">Date</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1392 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1398 ">
                  <p style="margin-bottom:0;">A date for which the function is to calculate the difference in number of days between the
                    first date. Specify a date as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Positive Days Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Positive Days Example

Formula: `DATEDIFF("02/01/2000", "2001-02-01")`

Return value: `366`

![Negative Days Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Negative Days Example

Formula: `DATEDIFF("2001-02-01", "02/01/2000")`

Return value: `-366`

![Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time Example

Formula: `DATEDIFF("2025-02-04T00:00:00", "2025-03-04T00:00:00")`

Return value: `28`

![Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time Example

Formula: `DATEDIFF("2025-02-04T12:00:00", "2025-03-04T11:59:59")`

Return value: `27`

![Date and Time with Time Zone Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time with Time Zone Example

Formula: `DATEDIFF("2025-02-04T12:00:00-0500", "2025-03-04T11:59:59+0000")`

Return value: `28`

![JSON Object Examples](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

JSON Object Examples

Sample data:

```
"Account": [
  {
    "Cases": [
      {
        "Case1": {
          "CreatedDate": "2/1/2024T16:35:30 GMT -0500 (EDT)",
          "LastUpdate": "2/8/2024T09:15:00 GMT -0500 (EDT)"
        }
      },
      {
        "Case2": {
          "CreatedDate": "2/2/2025T11:05:05 GMT -0500 (EDT)",
          "LastUpdate": "2/3/2025T15:50:57 GMT -0500 (EDT)"
        }
      }
    ]
  }
]
```

Formula: `DATEDIFF(Account:Cases:Case1:CreatedDate, Account:Cases:Case1:LastUpdate)`

Return value: `7`

Formula: `DATEDIFF(%Account:Cases:Case2:CreatedDate%, TODAY())`

Return value: `8`

## Omnistudio DATETIMETOUNIX Function

Returns the number of milliseconds in UNIX time for a specified date and time.

UNIX time is the number of non-leap seconds that have passed since 00:00:00 on 1 January 1970, Coordinated Universal Time (UTC). UTC is the same as Greenwich Mean Time (GMT). The value is referred to as the UNIX epoch.

### Signature

`DATETIMETOUNIX(datetime)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1654">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1660">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1666">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1672">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1654 ">
                  <p style="margin-bottom:0;"><code><var>datetime</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1660 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1666 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1672 ">
                  <p style="margin-bottom:0;">A date and time specified as a string in
                    <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js
                      format</a>. You can also specify just a date.
                  </p>
                </td>

              </tr>
            </tbody>
          </table>

![Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time Example

Formula: `DATETIMETOUNIX("2002-02-01T16:35:30:000Z")`

Formula: `DATETIMETOUNIX("2002-02-01T16:35:30:000")`

Formula: `DATETIMETOUNIX("2002-02-01T16:35:30")`

Formula: `DATETIMETOUNIX("02/01/2002T16:35:30")`

Return value: `1012581330000`

![Date And Zero Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date And Zero Time Example

Formula: `DATETIMETOUNIX("2002-02-01")`

Formula: `DATETIMETOUNIX("02/01/2002")`

Formula: `DATETIMETOUNIX("2002-02-01T00:00:00")`

Formula: `DATETIMETOUNIX("02/01/2002T00:00:00")`

Formula: `DATETIMETOUNIX("2002-02-01T00:00:00Z")`

Formula: `DATETIMETOUNIX("02/01/2002T00:00:00Z")`

Return value: `1012521600000`

## Omnistudio DAY Function

Returns the day for a specified date as an integer value.

### Signature

`DAY(date)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1854">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1860">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1866">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e1872">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1854 ">
                  <p style="margin-bottom:0;"><code><var>date</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1860 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1866 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e1872 ">
                  <p style="margin-bottom:0;">A date specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Date String Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date String Example

Formula: `DAY("2025-01-31")`

Formula: `DAY("01/31/2025")`

Formula: `DAY("1/31/2025")`

Return value: `31`

![JSON Object Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

JSON Object Example

Sample data: `"Birthdate": "2002-02-15T16:35:30 GMT -0500 (EDT)"`

Formula: `DAY(Birthdate)`

Return value: `15`

## Omnistudio EOM Function

Returns the date and time of the last day of the month for a specified date.

### Signature

`EOM(date)`

### Return Value

Datetime

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2028">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2034">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2040">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2046">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2028 ">
                  <p style="margin-bottom:0;"><code><var>date</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2034 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2040 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2046 ">
                  <p style="margin-bottom:0;">A date specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Date Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date Example

Formula: `EOM("2024-02-01")`

Formula: `EOM("02/01/2024")`

Return value: `"2024-02-29T00:00:00.000Z"`

![Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time Example

Formula: `EOM("02/01/2024T16:35:30")`

Formula: `EOM("02/01/2024T16:35:30Z")`

Return value: `"2024-02-29T00:00:00.000Z"`

## Omnistudio FORMATDATETIME Function

Returns a date and time as a string in a specified format and time zone.

Greenwich Mean Time (GMT) is the same as Coordinated Universal Time (UTC), which serves as the basis of UNIX time and the UNIX epoch.

### Signature

`FORMATDATETIME(datetime, format, timezone)`

### Return Value

String

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2208">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2214">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2220">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2226">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2208 ">
                  <p style="margin-bottom:0;"><code><var>datetime</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2214 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2220 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2226 ">
                  <p style="margin-bottom:0;">A date and time specified as a string in
                    <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js
                      format</a>. You can specify just a date or time. If you specify only a date, the default
                    time is <code>00:00:00</code>. If you specify only a time, the default date is
                    <code>1970-01-01</code> (the UNIX epoch).
                  </p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2208 ">
                  <p style="margin-bottom:0;"><code><var>format</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2214 ">
                  <p style="margin-bottom:0;">String</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2220 ">
                  <p style="margin-bottom:0;">Optional</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2226 ">
                  <p style="margin-bottom:0;">A string that specifies the format in which to return the date and time. Use Java
                    <a href="https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html" target="_blank">SimpleDateFormat</a>
                    notation to specify the format of the response. By default, the function returns the
                    date and time in the format <code>"MM/DD/YY HH:mm aaa"</code>.
                  </p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2208 ">
                  <p style="margin-bottom:0;"><code><var>timezone</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2214 ">
                  <p style="margin-bottom:0;">String</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2220 ">
                  <p style="margin-bottom:0;">Optional</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2226 ">
                  <p style="margin-bottom:0;">A string that indicates the time zone in which to return the date and time. By default,
                    the function returns the date and time in the caller's time zone. To use a different time zone,
                    specify a time zone identifier, for example, <code>America/New_York</code>. For a complete
                    list of time zone identifiers, see <a href="https://nodatime.org/TimeZones" target="_blank">IANA (TZDB) time zone information</a>. If you specify
                    a <var>timezone</var>, you must also specify a <var>format</var>.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Date with No Time, Format, or Time Zone Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date with No Time, Format, or Time Zone Example

Formula: `FORMATDATETIME("01/31/2025")`

Return value: `"1/30/25 4:00 PM"`

![Datetime with No Format or Time Zone Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Datetime with No Format or Time Zone Example

Formula: `FORMATDATETIME("01/31/2025T12:00:00")`

Return value: `"1/31/25 4:00 AM"`

![Datetime with No Time Zone Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Datetime with No Time Zone Example

Formula: `FORMATDATETIME("01/31/2025T12:00:00", "yyyy-MM-dd'T'HH:mm:ssZ")`

Return value: `"2025-01-31T04:00:00-0800"`

![Datetime Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Datetime Example

Formula: `FORMATDATETIME("01/31/2025T12:00:00", "yyyy-MM-dd'T'HH:mm:ssZ", "America/Los_Angeles")`

Return value: `"2025-01-31T04:00:00-0800"`

![Datetime Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Datetime Example

Formula: `FORMATDATETIME("01/31/2025T12:00:00", "yyyy-MM-dd'T'HH:mm:ssZ", "America/New_York")`

Return value: `"2025-01-31T07:00:00-0500"`

## Omnistudio FORMATDATETIMEGMT Function

Returns a date and time as a string in a specified format and in the GMT time zone.

Greenwich Mean Time (GMT) is the same as Coordinated Universal Time (UTC), which serves as the basis of UNIX time and the UNIX epoch.

### Signature

`FORMATDATETIMEGMT(datetime, timezone, format)`

### Return Value

String

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2509">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2515">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2521">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2527">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2509 ">
                  <p style="margin-bottom:0;"><code><var>datetime</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2515 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2521 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2527 ">
                  <p style="margin-bottom:0;">A date and time specified as a string in
                    <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js
                      format</a>. You can specify just a date or time. If you specify only a date, the default
                    time is <code>00:00:00</code>. If you specify only a time, the default date is
                    <code>1970-01-01</code> (the UNIX epoch).
                  </p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2509 ">
                  <p style="margin-bottom:0;"><code><var>timezone</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2515 ">
                  <p style="margin-bottom:0;">String</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2521 ">
                  <p style="margin-bottom:0;">Optional</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2527 ">
                  <p style="margin-bottom:0;">A string that indicates the time zone of the specified date and time. By default, the
                    function uses the caller's time zone. To use a different time zone, specify a time zone
                    identifier, for example, <code>America/New_York</code>. For a complete list of time
                    zone identifiers, see <a href="https://nodatime.org/TimeZones" target="_blank">IANA
                      (TZDB) time zone information</a>.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2509 ">
                  <p style="margin-bottom:0;"><code><var>format</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2515 ">
                  <p style="margin-bottom:0;">String</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2521 ">
                  <p style="margin-bottom:0;">Optional</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2527 ">
                  <p style="margin-bottom:0;">A string that specifies the format in which to return the date and time. Use Java
                    <a href="https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html" target="_blank">SimpleDateFormat</a>
                    notation to specify the format of the response. By default, the function returns the
                    date and time in the format <code>"MM/DD/YY HH:mm aaa"</code>. If you specify a
                    <var>format</var>, you must also specify a <var>timezone</var>.
                  </p>
                </td>

              </tr>
            </tbody>
          </table>

![Date with No Time, Time Zone, or Format Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date with No Time, Time Zone, or Format Example

Formula: `FORMATDATETIMEGMT("01/31/2025")`

Return value: `"2025-01-31T08:00:00.000Z"`

![Datetime with No Time Zone or Format Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Datetime with No Time Zone or Format Example

Formula: `FORMATDATETIMEGMT("01/31/2025T12:00:00")`

Return value: `"2025-01-31T20:00:00.000Z"`

![Datetime with No Format Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Datetime with No Format Example

Formula: `FORMATDATETIMEGMT("01/31/2025T12:00:00", "America/Los_Angeles")`

Return value: `"2025-01-31T20:00:00.000Z"`

![Datetime Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Datetime Example

Formula: `FORMATDATETIMEGMT("01/31/2025T12:00:00", "America/Los_Angeles", "yyyy-MM-dd'T'HH:mm:ssZ")`

Return value: `"2025-01-31T20:00:00+0000"`

![Datetime Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Datetime Example

Formula: `FORMATDATETIMEGMT("01/31/2025T12:00:00", "America/New_York", "yyyy-MM-dd'T'HH:mm:ssZ")`

Return value: `"2025-01-31T17:00:00+0000"`

## Omnistudio HOUR Function

Returns the hour for a specified time as an integer value.

### Signature

`Hour(time)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2797">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2803">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2809">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2815">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2797 ">
                  <p style="margin-bottom:0;"><code><var>time</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2803 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2809 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2815 ">
                  <p style="margin-bottom:0;">A time specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Time Example

Formula: `HOUR("08:00:00")`

Formula: `HOUR("T08:00:00")`

Return value: `8`

![Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time Example

Formula: `HOUR("2004-02-01T08:00:00Z")`

Formula: `HOUR("02/01/2004T08:00:00Z")`

Return value: `8`

![JSON Object Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

JSON Object Example

Sample data: `"DateField": "2003-02-01T16:35:30Z"`

Formula: `HOUR(%DateField%)`

Return value: `16`

## Omnistudio MINUTE Function

Returns the minute for a specified time as an integer value.

### Signature

`MINUTE(time)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2987">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2993">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e2999">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3005">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2987 ">
                  <p style="margin-bottom:0;"><code><var>time</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2993 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e2999 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3005 ">
                  <p style="margin-bottom:0;">A time specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Time Example

Formula: `MINUTE("08:17:00")`

Formula: `MINUTE("T08:17:00")`

Return value: `17`

![Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time Example

Formula: `MINUTE("2004-02-01T08:17:00Z")`

Formula: `MINUTE("02/01/2004T08:17:00Z")`

Return value: `17`

![JSON Object Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

JSON Object Example

Sample data: `"DateField": "2003-02-01T16:35:30Z"`

Formula: `MINUTE(DateField)`

Return value: `35`

## Omnistudio MONTH Function

Returns the month for a specified date as an integer value.

### Signature

`MONTH(date)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3176">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3182">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3188">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3194">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3176 ">
                  <p style="margin-bottom:0;"><code><var>date</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3182 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3188 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3194 ">
                  <p style="margin-bottom:0;">A date specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Date String Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date String Example

Formula: `MONTH("2025-01-01")`

Formula: `MONTH("01/01/2025")`

Formula: `MONTH("1/1/2025")`

Return value: `1`

![JSON Object Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

JSON Object Example

Sample data: `"Birthdate": "2007-06-25T08:35:00Z"`

Formula: `MONTH(%Birthdate%)`

Return value: `6`

## Omnistudio NOW Function

Returns the current date and time in a specified format.

By default, the function returns the date and time in Coordinated Universal Time (UTC). UTC is the same as Greenwich Mean Time (GMT). Use the `$Vlocity.NOW` environment variable to apply the time zone of the user or org.

You can use the `NOW` function with other functions to specify a date and time relative to the current date and time.

### Signature

`NOW(format)`

### Return Value

Datetime

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3365">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3371">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3377">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3383">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3365 ">
                  <p style="margin-bottom:0;"><code><var>format</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3371 ">
                  <p style="margin-bottom:0;">String</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3377 ">
                  <p style="margin-bottom:0;">Optional</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3383 ">
                  <p style="margin-bottom:0;">A format string in <a href="https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html" target="_blank">SimpleDateFormat</a>
                    notation that specifies the format of the response. By default, the function returns
                    the date and time in the format <code>"yyyy-MM-dd'T'HH:mm:ss:SSS"</code> UTC (GMT).</p>
                </td>

              </tr>
            </tbody>
          </table>

![No Format Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

No Format Example

Formula: `NOW()`

Return value: `"2025-03-08T22:01:46.684Z"`

![Java SimpleDateFormat Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Java SimpleDateFormat Date and Time Example

Formula: `NOW("yyyy-MM-dd'T'HH:mm:ss")`

Return value: `"2025-03-08T22:10:42"`

![Java SimpleDateFormat Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Java SimpleDateFormat Date and Time Example

Formula: `NOW("yyyy-MM-dd'T'HH:mm:ss z")`

Return value: `"2025-03-08T22:08:24 GMT"`

![Java SimpleDateFormat Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Java SimpleDateFormat Date and Time Example

Formula: `NOW("yyyy-MM-dd'T'HH:mm:ss Z")`

Return value: `"2025-03-08T22:07:30 +0000"`

![Java SimpleDateFormat Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Java SimpleDateFormat Date and Time Example

Formula: `NOW("yyyy-MM-dd'T'HH:mm:ss:SSS")`

Return value: `"2025-03-08T21:59:24:895"`

![Java SimpleDateFormat Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Java SimpleDateFormat Date and Time Example

Formula: `NOW("yyyy-MM-dd'T'HH:mm:ss:SSSz")`

Return value: `"2025-03-08T21:57:48:740GMT"`

![Java SimpleDateFormat Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Java SimpleDateFormat Date and Time Example

Formula: `NOW("yyyy-MM-dd'T'HH:mm:ss:SSSZ")`

Return value: `"2025-03-08T21:58:08:412+0000"`

![Java SimpleDateFormat Date-Only Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Java SimpleDateFormat Date-Only Example

Formula: `NOW("yyyy-MM-dd")`

Formula: `NOW("MM/dd/yyyy")`

Return value: `"03/08/2025"`

![Java SimpleDateFormat Time-Only Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Java SimpleDateFormat Time-Only Example

Formula: `NOW("HH:mm:ss")`

Return value: `"22:12:30"`

![Java SimpleDateFormat Time-Only Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Java SimpleDateFormat Time-Only Example

Formula: `NOW("HH:mm:ss.SSS")`

Return value: `"22:13:43.304"`

![Multiple Functions Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Multiple Functions Example

Sample data: The function is called on 8 March 2025 at 10:16:19 UTC (GMT) ("2025-03-08T22:16:19Z").

Formula: `DATETIMETOUNIX(NOW("yyyy-MM-dd'T'HH:mm:ss"))`

Return value: `1741472179000`

![Multiple Functions Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Multiple Functions Example

Sample data: The function is called on 8 March 2025 at 10:16:19 UTC (GMT) ("2025-03-08T22:16:19.956Z").

Formula: `DATETIMETOUNIX(NOW())`

Return value: `1741472179956`

## Omnistudio SECOND Function

Returns the second for a specified time as an integer value.

### Signature

`SECOND(time)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3689">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3695">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3701">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3707">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3689 ">
                  <p style="margin-bottom:0;"><code><var>time</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3695 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3701 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3707 ">
                  <p style="margin-bottom:0;">A time specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Time Example

Formula: `SECOND("08:00:59")`

Formula: `SECOND("T08:00:59")`

Return value: `59`

![Date and Time Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time Example

Formula: `SECOND("2004-02-01T08:00:59Z")`

Formula: `SECOND("02/01/2004T08:00:59Z")`

Return value: `59`

![JSON Object Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

JSON Object Example

Sample data: `"DateField": "2003-02-01T16:35:30Z"`

Formula: `SECOND(%DateField%)`

Return value: `30`

## Omnistudio TIMEDIFF Function

Returns the difference in number of milliseconds between two specified times as an integer.

The second time is subtracted from the first time. If the second time is greater than the first time, the function returns a negative integer. If you specify a time zone, the function considers it in its calculation.

### Signature

`TIMEDIFF(firstTime, secondTime)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3888">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3894">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3900">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e3906">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3888 ">
                  <p style="margin-bottom:0;"><code><var>firstTime</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3894 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3900 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3906 ">
                  <p style="margin-bottom:0;">A time specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time. If
                    you specify just a date, the function uses <code>00:00:00:000</code> as the time.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3888 ">
                  <p style="margin-bottom:0;"><code><var>secondTime</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3894 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3900 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e3906 ">
                  <p style="margin-bottom:0;">A time for which the function is to calculate the difference in number of milliseconds
                    between the first time. Specify a time as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time. If
                    you specify just a date, the function uses <code>00:00:00:000</code> as the time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Positive Times Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Positive Times Example

Formula: `TIMEDIFF("16:35:30", "08:00:15")`

Return value: `30915000`

![Negative Times Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Negative Times Example

Formula: `TIMEDIFF("T08:00:15", "T16:35:30")`

Return value: `-30915000`

![Positive Dates Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Positive Dates Example

Formula: `TIMEDIFF("2001-02-01", "02/01/2000")`

Return value: `31622400000`

![Date and Time with Time Zone Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date and Time with Time Zone Example

Formula: `TIMEDIFF("03/01/2025T12:00:00+0000", "03/01/2025T12:00:00-0500")`

Return value: `43200000`

![JSON Object Examples](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

JSON Object Examples

Sample data:

```
"Account": [
  {
    "Cases": [
      {
        "Case1": {
          "CreatedDate": "2/1/2024T16:35:30 GMT -0500 (EDT)",
          "LastUpdate": "2/8/2024T09:15:00 GMT -0500 (EDT)"
        }
      },
      {
        "Case2": {
          "CreatedDate": "2/2/2025T11:05:05 GMT -0500 (EDT)",
          "LastUpdate": "2/3/2025T15:50:57 GMT -0500 (EDT)"
        }
      }
    ]
  }
]
```

Formula: `TIMEDIFF(Account:Cases:Case2:CreatedDate, Account:Cases:Case2:LastUpdate)`

Return value: `-86400000`

Formula: `TIMEDIFF(%Account:Cases:Case2:LastUpdate%, %Account:Cases:Case2:CreatedDate%)`

Return value: `86400000`

## Omnistudio TODAY Function

Returns the current date.

The `TODAY` function always returns the current date in the format `"YYYY-MM-DD"`. By default, the function returns the date in Coordinated Universal Time (UTC). UTC is the same as Greenwich Mean Time (GMT). Use the `$Vlocity.NOW` environment variable to apply the time zone of the user or org.

You can use the `TODAY` function with other functions to specify a date relative to the current date.

### Signature

`TODAY()`

### Return Value

Datetime

### Parameters

None

![Today Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Today Example

Formula: `TODAY()`

Return value: `"2025-01-15"`

![First Day of Next Year Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

First Day of Next Year Example

Formula: `CONCAT(YEAR(ADDYEAR(TODAY(), 1)), "-01-01")`

Return value: `"2026-01-01"`

## Omnistudio UNIXTODATETIME Function

Returns the date and time for a number of seconds or milliseconds specified in UNIX time.

UNIX time is the number of non-leap seconds that have passed since 00:00:00 on 1 January 1970, Coordinated Universal Time (UTC). UTC is the same as Greenwich Mean Time (GMT). The value is referred to as the UNIX epoch.

### Signature

`UNIXTODATETIME(timestamp)`

### Return Value

Datetime

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e4252">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e4258">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e4264">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e4270">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e4252 ">
                  <p style="margin-bottom:0;"><code><var>timestamp</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e4258 ">
                  <p style="margin-bottom:0;">Integer</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e4264 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e4270 ">
                  <p style="margin-bottom:0;">A positive integer that represents the number of seconds or millseconds that have
                    passed since the UNIX epoch. The value is referred to as a UNIX timestamp.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Timestamp in Seconds Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Timestamp in Seconds Example

Formula: `UNIXTODATETIME(1012581330)`

Return value: `"2002-02-01T16:35:30.000Z"`

![Timestamp in Milliseconds Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Timestamp in Milliseconds Example

Formula: `UNIXTODATETIME(1012581330000)`

Return value: `"2002-02-01T16:35:30.000Z"`

## Omnistudio YEAR Function

Returns the year for a specified date as an integer value.

### Signature

`YEAR(date)`

### Return Value

Integer

### Parameters

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:16.666666666666664%">
              <col style="width:50%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e4407">
                  <p style="margin-bottom:0;">Parameter</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e4413">
                  <p style="margin-bottom:0;">Data Type</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e4419">
                  <p style="margin-bottom:0;">Necessity</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d35268e4425">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Parameter" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e4407 ">
                  <p style="margin-bottom:0;"><code><var>date</var></code></p>
                </td>

                <td data-label="Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e4413 ">
                  <p style="margin-bottom:0;">Datetime</p>
                </td>

                <td data-label="Necessity" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e4419 ">
                  <p style="margin-bottom:0;">Required</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d35268e4425 ">
                  <p style="margin-bottom:0;">A date specified as a string in <a href="https://day.js.org/docs/en/display/format" target="_blank">Day.js format</a>. You can specify a date and time.</p>
                </td>

              </tr>
            </tbody>
          </table>

![Date String Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

Date String Example

Formula: `YEAR("2025-01-01")`

Formula: `YEAR("01/01/2025")`

Formula: `YEAR("1/1/2025")`

Return value: `2025`

![JSON Object Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_example.png)

JSON Object Example

Sample data:

```
"Account": [
  {
    "Cases": [
      {
        "Case1": {
          "CreatedDate": "2/1/2024T16:35:30 GMT -0500 (EDT)",
          "LastUpdate": "2/8/2024T09:15:00 GMT -0500 (EDT)"
        }
      },
      {
        "Case2": {
          "CreatedDate": "2/2/2025T11:05:05 GMT -0500 (EDT)",
          "LastUpdate": "2/3/2025T15:50:57 GMT -0500 (EDT)"
        }
      }
    ]
  }
]
```

Formula: `YEAR(Account:Cases:Case1:CreatedDate)`

Return value: `2024`

Formula: `YEAR(Account:Cases:Case2:CreatedDate)`

Return value: `2025`