# Dates & Times

> Get, format, and compare dates and times.

Built-in step · 16 steps. Web page: https://docs.lodol.com/docs/integrations/built-in/datetime

## Steps

### Add or subtract time

Shift a date by an amount and unit, like +3 days or -2 hours, or move it to a day of the week, like next Monday. Use a negative amount to go back in time. A date stays a date (three days after 2026-10-09 is 2026-10-12), and a time keeps its clock time across daylight saving changes. Handy for due dates, reminders, and expiry dates.

**Inputs**

- Date (`date`, text, required): The starting date, like 2026-06-30, June 30, 2026 or 6/30/2026 9:30 AM.
- Amount (`amount`, number, required): How much to shift the date by. Use a negative number to subtract, like -2 to go back two units. With a day of the week, 1 is the next one and -1 the last one.
- Unit (`unit`, text, required): The unit of time to add or subtract, or a day of the week to move to, like next Monday. One of: `seconds`, `minutes`, `hours`, `days`, `weekdays` (Working days (Mon-Fri)), `weeks`, `months`, `quarters`, `years`, `mondays` (Mondays (1 is the next Monday)), and 6 more. Default: `days`.

**Outputs**: The new date (2026-07-03) when you started from a date, otherwise the new date and time as an ISO 8601 timestamp in your time zone.

**Example output**

```json
"2026-07-03"
```

### Check business day

Check whether a date is a business day: a weekday that is not a public holiday.

**Inputs**

- Date (`date`, text, required): The date to check, like 2026-06-30.
- Country (`region`, text): The country whose public holidays are skipped. Defaults to the United States. Default: `US`.

**Outputs**: Whether the date is a weekday that is not a public holiday in the region.

**Example output**

```json
true
```

### Check holiday

Check whether a date is a public holiday.

**Inputs**

- Date (`date`, text, required): The date to check, like 2026-06-30.
- Country (`region`, text): The country whose public holidays count. Defaults to the United States. Default: `US`.

**Outputs**: Whether the date is a public holiday in the region, or the weekday a weekend holiday is observed on.

**Example output**

```json
true
```

### Check if a date is recent or coming up

Check whether a date falls within the last or next few days, weeks or months, like an order from the last 7 days or a renewal in the next 30. Today counts.

**Inputs**

- Date (`date`, text, required): The date to check, like 2026-06-30.
- Within the (`direction`, text, required): Look back from today, or ahead. One of: `last`, `next`. Default: `last`.
- Amount (`amount`, number, required): How many, like 7 for the last 7 days.
- Unit (`unit`, text, required): Days, weeks, months, and so on. One of: `seconds`, `minutes`, `hours`, `days`, `weekdays` (Working days (Mon-Fri)), `weeks`, `months`, `quarters`, `years`. Default: `days`.

**Outputs**: Whether the date is within that many days, weeks or months of today, today included.

**Example output**

```json
true
```

### Check weekend

Check whether a date falls on a weekend (Saturday or Sunday).

**Inputs**

- Date (`date`, text, required): The date to check, like 2026-06-30.

**Outputs**: Whether the date falls on a Saturday or Sunday.

**Example output**

```json
false
```

### Current date and time

Get the current date and time.

**Inputs**: None.

**Outputs**: The current date and time as an ISO 8601 timestamp with milliseconds, in your account's time zone.

**Example output**

```json
"2026-10-01T22:31:17.751-04:00"
```

### Current Unix timestamp

Get the current time as a Unix timestamp: the number of seconds since January 1, 1970.

**Inputs**: None.

**Outputs**: The current time as whole seconds since January 1, 1970 (UTC).

**Example output**

```json
1790908277
```

### Day of week

Get the weekday for a date, like Monday or Saturday.

**Inputs**

- Date (`date`, text, required): The date to look up, like 2026-06-30.

**Outputs**: The day of the week of the date in your time zone, such as Monday.

**Example output**

```json
"Friday"
```

### Difference between dates

Measure the time between two dates in a chosen unit (years, quarters, months, weeks, working days, days, hours, minutes, or seconds). Months, quarters and years count complete calendar months, so a start date of 2022-07-03 is 4 years before 2026-07-03; working days count Monday to Friday. Dates are read in your time zone. The result is signed: positive when the end date is after the start date, negative when it's before. Unlike the Time until date action, which counts from now, this measures between two dates you provide.

**Inputs**

- Start date (`start`, text, required): The date to measure from, like 2026-06-30, June 30, 2026 or 6/30/2026 9:30 AM.
- End date (`end`, text, required): The date to measure to, like 2026-06-30, June 30, 2026 or 6/30/2026 9:30 AM.
- Unit (`unit`, text, required): The unit to measure the difference in. One of: `seconds`, `minutes`, `hours`, `days`, `weekdays` (Working days (Mon-Fri)), `weeks`, `months`, `quarters`, `years`. Default: `days`.

**Outputs**: The whole number of units from the start date to the end date, negative if the end date is earlier.

**Example output**

```json
73
```

### Get date part

Pull a single component out of a date: the year, quarter, month, week of the year, day of the month, month and day together, day of the week, hour, or minute, read in your time zone. Returns a number for every part except day of the week, which returns the weekday name like Monday, and month and day, which returns text like 07-03. Use it for conditional logic on a date, such as acting only in December or only on the 1st, or compare the month and day of two dates to find anniversaries and birthdays.

**Inputs**

- Date (`date`, text, required): The date to read from, like 2026-06-30, June 30, 2026 or 6/30/2026 9:30 AM.
- Part (`part`, text, required): Which component of the date to extract. One of: `year`, `quarter` (Quarter (1-4)), `month` (Month (1-12)), `month_name` (Month name (July)), `week` (Week of year (1-53)), `day_of_year` (Day of year (1-366)), `day_of_month` (Day of month (1-31)), `month_day` (Month and day (07-03)), `day_of_week` (Day of week (Monday)), `hour` (Hour (0-23)), `minute` (Minute (0-59)), `second` (Second (0-59)). Default: `month`.

**Outputs**: The part of the date (in your time zone) that was asked for: a number for the year, quarter, month, week, day of the year or month, hour, minute or second, the name for the month name and the day of the week, or MM-DD text for the month and day.

**Example output**

```json
7
```

### Make date readable

Turn a date into a friendly format for emails, messages, or reports.

**Inputs**

- Date (`date`, text, required): The date to make readable, like 2026-06-30, June 30, 2026 or 6/30/2026 9:30 AM.
- Format (`format`, text): How to show the date: a long date and time, just the date or the time, an ISO 8601 timestamp, how long ago or until it is, or your own pattern. One of: `long` (Long (July 3, 2026 4:30 PM)), `short` (Short (7/3/2026 4:30 PM)), `date` (Date only (July 3, 2026)), `time` (Time only (4:30 PM)), `iso` (ISO 8601 (2026-07-03T16:30:00Z)), `relative` (Relative (3 days ago)), `custom` (My own pattern). Default: `long`.
- Pattern (`pattern`, text): How to write the date, using these codes: YYYY (2026), MMMM (July), MMM (Jul), MM (07), D (3), Do (3rd), dddd (Friday), ddd (Fri), h (4), HH (16), mm (30), A (PM). Other characters are written as they are, and text in [brackets] is never read as codes. For example, dddd, MMMM D gives Friday, July 3. Only when Format is My own pattern.
- Time zone (`timezone`, text): Which time zone to use, like America/New_York. Without one, it is your own time zone from Settings (UTC if you haven't set one).
- Date is written (`written_as`, text): How to read a date written in numbers, like 03/07/2026: the way people write dates in your country, or always day first or month first. Use this for dates that come from another country. One of: `auto` (The way my country writes it), `day_first` (Day first (31/12/2026)), `month_first` (Month first (12/31/2026)). Default: `auto`.

**Outputs**: The date as readable text, in the chosen format and time zone.

**Example output**

```json
"July 3, 2026 4:30 PM"
```

### Start or end of a period

Get the first or last day of the week, month, quarter or year a date falls in, like the 1st of this month or the end of the quarter.

**Inputs**

- Date (`date`, text, required): A date in the period, like today. For last month, go back a month with Add or subtract time first.
- Get the (`edge`, text, required): The first or the last day of the period. One of: `start`, `end`. Default: `start`.
- Of the (`period`, text, required): Which period. Weeks run Monday to Sunday. One of: `day`, `week` (Week (Monday to Sunday)), `month`, `quarter`, `year`. Default: `month`.

**Outputs**: The first or last day of the period (2026-07-01) when you started from a date, otherwise its first or last moment as an ISO 8601 timestamp in your time zone.

**Example output**

```json
"2026-07-01"
```

### Time until date

Find out how many seconds remain until a date and time.

**Inputs**

- Date and time (`date`, date and time, required): The moment to count down to. Pick it from the field, or reference a variable with @ to count down to a date and time an earlier step produced.

**Outputs**: The whole number of seconds from now until the date, negative if it has passed.

**Example output**

```json
7853322
```

### Today's date

Get today's date.

**Inputs**

- Time zone (`timezone`, text): Which time zone to use, like America/New_York. Without one, it is your own time zone from Settings (UTC if you haven't set one).

**Outputs**: Today's date as YYYY-MM-DD, in the chosen time zone or your account's.

**Example output**

```json
"2026-10-02"
```

### Tomorrow's date

Get tomorrow's date.

**Inputs**

- Time zone (`timezone`, text): Which time zone to use, like America/New_York. Without one, it is your own time zone from Settings (UTC if you haven't set one).

**Outputs**: Tomorrow's date as YYYY-MM-DD, in the chosen time zone or your account's.

**Example output**

```json
"2026-10-03"
```

### Yesterday's date

Get yesterday's date.

**Inputs**

- Time zone (`timezone`, text): Which time zone to use, like America/New_York. Without one, it is your own time zone from Settings (UTC if you haven't set one).

**Outputs**: Yesterday's date as YYYY-MM-DD, in the chosen time zone or your account's.

**Example output**

```json
"2026-10-01"
```
