Info
This site is generated using the static site generator developed by the Typst Community. Please adjust the text content of this banner according to your usage requirements. At Typst GmbH's request, when publishing documentation, you must clearly indicate that it is non-official and display the version of Typst being documented. For details, refer to Issue #874 on typst/typst.
TypstDocumentEnglish
v0.dev.2025-09-12

duration

Represents a positive or negative span of time.

Constructor
Parameter
Parameters are input values for functions. Specify them in parentheses after the function name.

Creates a new duration.

You can specify the duration using weeks, days, hours, minutes and seconds. You can also get a duration by subtracting two datetimes.

#duration(
  days: 3,
  hours: 12,
).hours()
Preview

seconds

The number of seconds.

Default value:

0

minutes

The number of minutes.

Default value:

0

hours

The number of hours.

Default value:

0

days

The number of days.

Default value:

0

weeks

The number of weeks.

Default value:

0

Definition
Definition
These functions and types can have related definitions. To access a definition, specify the name of the function or type, followed by the definition name separated by a period.

seconds

The duration expressed in seconds.

This function returns the total duration represented in seconds as a floating-point number rather than the second component of the duration.

self.seconds(
)->

minutes

The duration expressed in minutes.

This function returns the total duration represented in minutes as a floating-point number rather than the second component of the duration.

self.minutes(
)->

hours

The duration expressed in hours.

This function returns the total duration represented in hours as a floating-point number rather than the second component of the duration.

self.hours(
)->

days

The duration expressed in days.

This function returns the total duration represented in days as a floating-point number rather than the second component of the duration.

self.days(
)->

weeks

The duration expressed in weeks.

This function returns the total duration represented in weeks as a floating-point number rather than the second component of the duration.

self.weeks(
)->
Open official docs

Search