Dates and durations
Get and change dates, calculate differences, and convert durations and dates to and from text.
Current date/time
Returns the current date and time.
Outputs
| Name | Type | Details |
|---|---|---|
| Now | Date and time | The current moment. |
Text to date
Reads a date from a text, optionally with a format. Times without a timezone are read in the bot's timezone.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Text | Text | Yes | Text representation of the date. |
| Format | Text | No | Optional format pattern. |
Outputs
| Name | Type | Details |
|---|---|---|
| Date | Date and time | The date, or empty if the text could not be read as a date. May be empty. |
Add to date
Adds a duration to a date and returns the new date.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Date | Date and time | Yes | The starting date. |
| Duration | Duration | Yes | How much to add. |
Outputs
| Name | Type | Details |
|---|---|---|
| Result | Date and time | The resulting date. |
Subtract from date
Subtracts a duration from a date and returns the new date.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Date | Date and time | Yes | The starting date. |
| Duration | Duration | Yes | How much to subtract. |
Outputs
| Name | Type | Details |
|---|---|---|
| Result | Date and time | The resulting date. |
Date difference
Returns the duration between two dates (a - b).
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| A | Date and time | Yes | First date. |
| B | Date and time | Yes | Second date. |
Outputs
| Name | Type | Details |
|---|---|---|
| Duration | Duration | The duration between the dates. |
Format date
Formats a date as a text using a format pattern, in the bot's timezone.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Date | Date and time | Yes | The date to format. |
| Format | Text | Yes | Format pattern (e.g. YYYY-MM-DD). |
| Locale | Text | No | Optional locale (e.g. de-DE). |
Outputs
| Name | Type | Details |
|---|---|---|
| Result | Text | The formatted text. |
Extract year
Returns the year part of a date, in the bot's timezone.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Date | Date and time | Yes | The date to inspect. |
Outputs
| Name | Type | Details |
|---|---|---|
| Year | Whole number | The year (e.g. 2026). |
Extract month
Returns the month part of a date (1-12), in the bot's timezone.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Date | Date and time | Yes | The date to inspect. |
Outputs
| Name | Type | Details |
|---|---|---|
| Month | Whole number | Month number 1-12. |
Extract day
Returns the day-of-month part of a date (1-31), in the bot's timezone.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Date | Date and time | Yes | The date to inspect. |
Outputs
| Name | Type | Details |
|---|---|---|
| Day | Whole number | Day-of-month 1-31. |
Extract hour
Returns the hour-of-day part of a date (0-23), in the bot's timezone.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Date | Date and time | Yes | The date to inspect. |
Outputs
| Name | Type | Details |
|---|---|---|
| Hour | Whole number | Hour 0-23. |
Extract weekday
Returns the day-of-week index (0 = Sunday, 6 = Saturday), in the bot's timezone.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Date | Date and time | Yes | The date to inspect. |
Outputs
| Name | Type | Details |
|---|---|---|
| Weekday | Whole number | Day-of-week index (0-6). |
Duration from ms
Builds a duration from a number of milliseconds.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Milliseconds | Whole number | Yes | Number of milliseconds. Minimum: 0. |
Outputs
| Name | Type | Details |
|---|---|---|
| Duration | Duration | The resulting duration. |
Duration to ms
Converts a duration to its total number of milliseconds.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Duration | Duration | Yes | The duration to convert. |
Outputs
| Name | Type | Details |
|---|---|---|
| Milliseconds | Whole number | Total milliseconds. |
Duration from parts
Builds a duration from days, hours, minutes, and seconds.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Days | Whole number | No | Number of days. Default: 0. |
| Hours | Whole number | No | Number of hours. Default: 0. |
| Minutes | Whole number | No | Number of minutes. Default: 0. |
| Seconds | Whole number | No | Number of seconds. Default: 0. |
Outputs
| Name | Type | Details |
|---|---|---|
| Duration | Duration | The resulting duration. |
Text to duration
Reads a human-readable duration such as "10m", "2h30m", "3d" or "1w2d" from text. Units are required, a bare number is not accepted. Returns the fallback (or fails) when the text cannot be read as a duration.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Text | Text | Yes | The duration text, e.g. "10m", "2h30m", "3d", "1w2d", "90s". |
| Fallback | Duration | No | Returned instead of failing when the text cannot be read as a duration. Leave empty to raise a catchable error on invalid input. |
Outputs
| Name | Type | Details |
|---|---|---|
| Duration | Duration | The duration, or the fallback when the text cannot be read. May be empty. |
Format duration
Formats a duration as human-readable text.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Duration | Duration | Yes | The duration to format. |
| Style | Duration style | Yes | How to render the duration: compact ("2h 30m"), long ("2 hours 30 minutes") or the largest unit only ("3 hours"). Default: Compact. |
Outputs
| Name | Type | Details |
|---|---|---|
| Text | Text | The formatted duration text. |
Text to date (everyday wording)
Reads everyday relative and absolute date and time wording into a date. Relative: "in 3 days"/"in 5 minuten" (English and German duration words, seconds/minutes/hours/days/weeks, month/year approximate), "tomorrow 8pm", "today 15:00", "next monday" (weekday names in English and German). Absolute: ISO-8601, "2024-03-05", "05.03.2024", "15:00". Returns the fallback (or fails) when the text cannot be read as a date.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Text | Text | Yes | The date/time text, e.g. "in 3 days", "in 5 minuten", "tomorrow 8pm", "next monday", "2024-03-05", "05.03.2024". |
| Reference time | Date and time | No | The "now" used for relative forms like "tomorrow" or "in 3 days". Defaults to the current time. |
| Timezone | Text | No | IANA timezone (e.g. "Europe/Berlin") used to interpret wall-clock times like "tomorrow 8pm". Defaults to the bot's timezone. |
| Fallback | Date and time | No | Returned instead of failing when the text cannot be read as a date. Leave empty to raise a catchable error on invalid input. |
Outputs
| Name | Type | Details |
|---|---|---|
| Date | Date and time | The date and time, or the fallback when the text cannot be read. May be empty. |
Time until
Measures the distance from the reference time to a target date. The milliseconds are negative when the target is in the past.
Inputs
| Name | Type | Required | Details |
|---|---|---|---|
| Target date | Date and time | Yes | The date and time to measure to. |
| Reference time | Date and time | No | The time to measure from. Defaults to the current time. |
Outputs
| Name | Type | Details |
|---|---|---|
| Milliseconds | Whole number | Signed milliseconds from the reference to the target (negative when the target is in the past). |
| Is in the past | Yes/No | True when the target is before the reference time. |
| Humanized | Text | A human-readable phrase such as "in 2 hours 30 minutes", "2 days ago" or "now". |