---
title: DATE
url: https://www.tines.com/docs/formulas/functions/date/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/docs/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# DATE

*[View on tines.com](https://www.tines.com/docs/formulas/functions/date/)*

Takes a date, represented by a string, an integer, or a DATE_PARSE object, and returns a formatted string representation.

The output format is defined in [ruby strftime (Time) syntax](https://docs.ruby-lang.org/en/3.3/strftime_formatting_rdoc.html).

Optionally, the output timezone can be specified with values from the [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

Natural language parsing is handled by [chronic](https://github.com/mojombo/chronic#examples). When it receives ambiguous dates, ie "01/02/2023", it will default to the EU format (DD/MM/YYYY). Combine with DATE_PARSE to explicitly define the format.

**Categories:** Dates/Times

## Syntax

```
DATE(date, format, timezone)
```

## Examples

### Example 1

Formula:

```
DATE("2022-07-17", "%a, %b %d, %y")
```

Output:

```json
"Fri, Jul 17, 21"
```

### Example 2

Formula:

```
DATE("2021-07-17", "%Y")
```

Output:

```json
"2021"
```

### Example 3: Takes DATE_PARSE objects

Formula:

```
DATE(DATE_PARSE("05/04/1994", "%d/%m/%Y"), "%B %e, %Y")
```

Output:

```json
"April 5, 1994"
```

### Example 4: Many different representations of dates are supported

Formula:

```
DATE("March 17, 2021", "%b %d, %y")
```

Output:

```json
"Mar 17, 21"
```

### Example 5: Natural language dates are supported. See [chronic](https://github.com/mojombo/chronic#examples) for more examples.

Formula:

```
DATE("fourteenth of May 2024", "%Y-%m-%d")
```

Output:

```json
"2024-05-14"
```

### Example 6: Relative times are supported. See [chronic](https://github.com/mojombo/chronic#examples) for more examples.

Formula:

```
DATE("tomorrow at 10am", "%Y-%m-%d %H:%M:%S")
```

Output:

```json
"2023-05-22 10:00:00"
```

### Example 7: Unix timestamps are supported

Formula:

```
DATE(1647712411, "%Y-%m-%dT%H:%M:%S")
```

Output:

```json
"2022-03-19T17:53:31"
```

### Example 8: Unix timestamps with 13+ digits are treated as milliseconds

Formula:

```
DATE(1687450077063, "%Y-%m-%dT%H:%M:%S.%L")
```

Output:

```json
"2023-06-22T16:07:57.063"
```

### Example 9: To get the current time, pass the keyword `"now"` (or `"today"`)

Formula:

```
DATE("now", "%Y-%m-%d %H:%M")
```

Output:

```json
"2022-03-11 16:24"
```

### Example 10: Defaults to iso8601 format with three decimal places if no format is provided

Formula:

```
DATE("now")
```

Output:

```json
"2022-03-11T16:24:01.123Z"
```

### Example 11: Takes optional timezone argument

Formula:

```
DATE("2023-05-19 12pm", "%Y-%m-%d %H:%M:%S %Z", "Asia/Tokyo")
```

Output:

```json
"2023-05-19 21:00:00 JST"
```

## Sample actions

```json
{
  "standardLibVersion": "13",
  "actionRuntimeVersion": "1",
  "agents": [
    {
      "disabled": false,
      "name": "DATE",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "now": "=DATE('now', '%Y-%m-%d %H:%M:%S')",
          "incoming_alert": "=DATE(my_action.time, '%Y-%m-%d %H:%M:%S')",
          "5_mins_ago": "=DATE(my_action.time, '%s') - 300 |> DATE(%, '%Y-%m-%d %H:%M:%S')"
        }
      },
      "position": {
        "x": -6540,
        "y": -1230
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "My Action",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "time": "2022-11-21 16:00:00"
        }
      },
      "position": {
        "x": -6540,
        "y": -1320
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 1,
      "receiverIdentifier": 0
    }
  ],
  "diagramNotes": []
}
```
