For the complete documentation index, see llms.txt. For a full content snapshot, see llms-full.txt. Append .md to any kestra.io/docs/* URL for plain Markdown.

These are the most common filters in scheduled flows and integrations. Reach for them whenever a downstream system expects a specific date format or timestamp precision rather than Kestra’s native datetime value.

date

{{ execution.startDate | date("yyyy-MM-dd") }}

You can also provide existing and target formats with named arguments:

{{ stringDate | date(existingFormat="yyyy-MMMM-d", format="yyyy/MMMM/d") }}

When you are formatting an already parsed datetime, only format is usually needed. Use existingFormat when the source is still a plain string.

Epoch timestamps

date also formats a Unix timestamp. A 13-digit number is read as epoch milliseconds, and a 10-digit number as epoch seconds:

{{ 1735689600000 | date("yyyy-MM-dd HH:mm:ss", timeZone="UTC") }}

This returns 2025-01-01 00:00:00. When the timestamp is a string, for example a field from a JSON payload, convert it with number('LONG') first. Without the LONG type, number returns an integer for a 10-digit value, and date fails on it.

{{ "1735689600" | number('LONG') | date("yyyy-MM-dd HH:mm:ss", timeZone="UTC") }}

To go the other way, from a date to epoch milliseconds, use timestampMilli.

Time zones

Specify a target time zone when downstream systems require a local representation rather than UTC:

{{ now() | date("yyyy-MM-dd'T'HH:mm:ssX", timeZone="UTC") }}

Supported arguments include:

  • format
  • existingFormat
  • timeZone
  • locale

dateAdd

Adds or subtracts time from a date. Arguments:

  • amount: integer specifying how much to add or subtract
  • unit: time unit such as DAYS, HOURS, MONTHS, or YEARS
{{ now() | dateAdd(-1, 'DAYS') }}

Timestamp helpers

Convert a date to a Unix timestamp at a specific precision:

  • timestamp — seconds
  • timestampMilli — milliseconds
  • timestampMicro — microseconds
  • timestampNano — nanoseconds

All timestamp filters accept the same arguments as the date filter: existingFormat and timeZone.

{{ now() | timestamp(timeZone="Europe/Paris") }}
{{ now() | timestampMilli(timeZone="Asia/Kolkata") }}

They also accept an ISO 8601 string. For example, {{ "2025-01-01T00:00:00Z" | timestampMilli }} returns 1735689600000.

Supported date formats include standard Java DateTimeFormatter patterns and shortcuts such as iso, sql, iso_date_time, and iso_zoned_date_time.

Worked example

id: temporal_dates
namespace: company.team
tasks:
- id: print_status
type: io.kestra.plugin.core.log.Log
message:
- "Present timestamp: {{ now() }}"
- "Formatted timestamp: {{ now() | date('yyyy-MM-dd') }}"
- "Previous day: {{ now() | dateAdd(-1, 'DAYS') }}"
- "Next day: {{ now() | dateAdd(1, 'DAYS') }}"
- "Timezone (seconds): {{ now() | timestamp(timeZone='Asia/Kolkata') }}"
- "Timezone (microseconds): {{ now() | timestampMicro(timeZone='Asia/Kolkata') }}"
- "Timezone (milliseconds): {{ now() | timestampMilli(timeZone='Asia/Kolkata') }}"
- "Timezone (nanoseconds): {{ now() | timestampNano(timeZone='Asia/Kolkata') }}"

This kind of example is a good sanity check when you are validating timestamp precision before sending values to an external API.

Was this page helpful?