types

Temporal types

Instants, dates, times, durations, and intervals: how to construct them and read their parts.

instant, date, time, duration, and interval represent points and spans of time. You construct them through the time namespace and read their parts with property access.

marreta
created = time.now()
year = created.year
hour = created.hour

window = time.interval(time.date("2026-01-01"), time.date("2026-01-31"))
days = window.duration.total_days

The types

TypeWhat it isConstruct with
instantA point in time.time.now(), time.instant("...")
dateA calendar date.time.today(), time.date("YYYY-MM-DD")
timeA wall-clock time.time.at("HH:MM:SS")
durationA length of time.time.seconds(n), time.minutes(n), time.hours(n), time.days(n)
intervalA span between two instants.time.interval(start, end)

Properties

Read the parts of a temporal value with a property:

OnProperties
instantyear, month, day, hour, minute, second, weekday, unix, date, time
dateyear, month, day
timehour, minute, second
durationtotal_days, total_hours, total_minutes, total_seconds
intervalduration

The total_* properties return a float.

Placing a time on a date

A time has an on(date) method that puts it on a date, producing an instant:

marreta
opening = time.at("09:30:00").on(time.date("2026-01-15"))

Notes

  • Local-time values follow MARRETA_TIMEZONE. See Configuration.
  • For comparing intervals (contains, overlaps) and formatting, see the time namespace.