Skip to content

Datetime Add

The datetime::add function adds a specified duration to a datetime value and returns the resulting datetime.

Syntax

datetime::add(<datetime>, <duration>)

Parameters

  • datetime: The input datetime value in ISO 8601 format (e.g., "2025-01-24T12:00:00Z").
  • duration: The duration to add, specified as a string (e.g., "1h30m" for 1 hour and 30 minutes).

Returns

  • Datetime: The resulting datetime after adding the specified duration.

Example

Try it out below!
datetime::add("2025-01-24T12:00:00Z", "1h30m")

This function is useful for manipulating datetime values in testing scenarios or time-based calculations.