# Date Time Formatter

## Overview

![The Date Time Formatter Node.](https://926825830-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKQhJdUBr7YQzfIwmpAZ9%2Fuploads%2Fgit-blob-c1f4d590d3be53d4ea8b832f9cd1689562e27b28%2Fdatetimeformatterupdatedimage.png?alt=media)

The **Date Time Formatter** **Node** outputs a *date* and/or *time* in a specified format. By using a combination of special *format characters*, many different date/time formats can be created. This is used mostly for localization, however, it could also be used for formatting based on user preferences.

For generating customized formats for the *date* and *time*, *format strings* are used. For more information about *format strings*, please see the [*format strings* section](#format-strings) below.

[**Scope**](https://docs.incari.com/incari-studio/2022.1/overview#scopes): **Project**, **Scene**, **Function**, **Prefab**.

## Attributes

![The Date Time Formatter Node Attributes.](https://926825830-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKQhJdUBr7YQzfIwmpAZ9%2Fuploads%2Fgit-blob-bca0c9adeb66fa8f209619743325ad20e9ff121a%2Fnode-date-time-formatter-attr.png?alt=media)

### Input

| Attribute          | Type          | Description                                                     |
| ------------------ | ------------- | --------------------------------------------------------------- |
| `Default Timezone` | **Drop-down** | The timezone that will be used, which is an offset of the UTC.  |
| `Default DST`      | **Drop-down** | Determines whether Daylight Savings Time is taken into account. |

### Output

| Attribute         | Type          | Description                                                                                             |
| ----------------- | ------------- | ------------------------------------------------------------------------------------------------------- |
| `Format Examples` | **Drop-down** | A selection of pre-defined formats. By selecting `Custom`, you can create a custom *formatting string*. |
| `Custom Format`   | **String**    | The *format string* which will determine how the date and/or time is represented.                       |

## Inputs

| Input                  | Type       | Description                                                                       |
| ---------------------- | ---------- | --------------------------------------------------------------------------------- |
| *Pulse Input* (►)      | **Pulse**  | A standard input **Pulse**, to trigger the execution of the **Node**.             |
| `UTC Unix (ms)`        | **Int**    | The UTC in Unix format.                                                           |
| `Timezone Offset (ms)` | **Int**    | The time offset in milliseconds.                                                  |
| `DST`                  | **Bool**   | Determines whether Daylight Savings Time is taken into account.                   |
| `Format`               | **String** | The *format string* which will determine how the date and/or time is represented. |

## Outputs

| Output             | Type       | Description                                                                                                                            |
| ------------------ | ---------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| *Pulse Output* (►) | **Pulse**  | A standard output **Pulse**, to move onto the next **Node** along the **Logic Branch**, once this **Node** has finished its execution. |
| `Output`           | **String** | The formatted date/time.                                                                                                               |

## Format Strings

*Format strings* are used for generating customized formats for the *date* and *time*. To use this, the `Custom` option has to be chosen in the `Format Examples` **Attribute** and then the *format string* is either given in the `Custom Format` **Attribute** or in the `Format` **Input Socket**.

This section shows first an example of a customized *format string* and its corresponding output, and then it gives a list of the *format characters*, which are the characters that compose a *format string*.

### Example

Setting the *format string*

```
h:m:s a, F j, Y.
```

will generate an output that looks like:

```
01:09:58 pm, September 14, 2022.
```

### Format characters

*Format characters* are the characters that compose a *format string*. The following table shows the most important *format characters*:

| *Format character* |                   Description                   |                         Example |
| ------------------ | :---------------------------------------------: | ------------------------------: |
| d                  |    Day of the month, including leading zeros    |                           01-31 |
| j                  |        Day of the month, no leading zeros       |                            1-31 |
| l                  |            Day of the week, full name           |                   Monday-Sunday |
| D                  |        Day of the week, three letter name       |                         Mon-Sun |
| m                  |      Month number, including leading zeros      |                           01-12 |
| n                  |          Month number, no leading zeros         |                            1-12 |
| F                  |                 Month, full name                |                January-December |
| M                  |             Month, three letter name            |                         Jan-Dec |
| Y                  |                Year, four digits                |                      1967, 2005 |
| y                  |              Year, last two digits              |                          67, 05 |
| a                  |        *Meridiem* indicator, in lowercase       |                          am, pm |
| A                  |        *Meridiem* indicator, in uppercase       |                          AM, PM |
| g                  |     Hour in 12-hour format, no leading zeros    |                            1-12 |
| h                  | Hour in 12-hour format, including leading zeros |                           01-12 |
| G                  |     Hour in 24-hour format, no leading zeros    |                            0-23 |
| H                  | Hour in 24-hour format, including leading zeros |                           00-23 |
| i                  |                     Minutes                     |                           00-59 |
| s                  |                     Seconds                     |                           00-59 |
| T                  |              Timezone abbreviation              |                        EST, MDT |
| c                  |                ISO 8601 standard                |       2022-09-14T10:09:34-03:00 |
| r                  |                RFC 2822 standard                | Wed, 14 Sep 2022 10:10:07 -0300 |

## See Also

* [**DateTime**](https://docs.incari.com/incari-studio/2022.1/toolbox/datetime)
* [**Timezone Value**](https://docs.incari.com/incari-studio/2022.1/toolbox/datetime/timezone-value)
* [**Now (UTC)**](https://docs.incari.com/incari-studio/toolbox/datetime/now-utc)

## External Links

* [*Formatting Date and Time*](https://wordpress.org/support/article/formatting-date-and-time/) on WordPress.org.
* [*PHP: date - Manual*](https://www.php.net/manual/en/function.date.php) on PHP.net.
* [*UTC - The World's Time Standard*](https://www.timeanddate.com/time/aboututc.html) on timeanddate.com.
