Skip to main content
Version: 1.x

Duration functions

These functions can be used when converting between numeric and duration data.

FunctionDescription
duration::days()Counts how many days fit in a duration
duration::hours()Counts how many hours fit in a duration
duration::micros()Counts how many microseconds fit in a duration
duration::millis()Counts how many milliseconds fit in a duration
duration::mins()Counts how many minutes fit in a duration
duration::nanos()Counts how many nanoseconds fit in a duration
duration::secs()Counts how many seconds fit in a duration
duration::weeks()Counts how many weeks fit in a duration
duration::years()Counts how many years fit in a duration
duration::from::days()Converts a numeric amount of days into a duration that represents days
duration::from::hours()Converts a numeric amount of hours into a duration that represents hours
duration::from::micros()Converts a numeric amount of microseconds into a duration that represents microseconds
duration::from::millis()Converts a numeric amount of milliseconds into a duration that represents milliseconds
duration::from::mins()Converts a numeric amount of minutes into a duration that represents minutes
duration::from::nanos()Converts a numeric amount of nanoseconds into a duration that represents nanoseconds
duration::from::secs()Converts a numeric amount of seconds into a duration that represents seconds
duration::from::weeks()Converts a numeric amount of weeks into a duration that represents weeks

duration::days

The duration::days function counts how many days fit into a duration.

API DEFINITION
duration::days(duration) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::days(3w);

21

duration::hours

The duration::hours function counts how many hours fit into a duration.

API DEFINITION
duration::hours(duration) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::hours(3w);

504

duration::micros

The duration::micros function counts how many microseconds fit into a duration.

API DEFINITION
duration::micros(duration) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::micros(3w);

1814400000000

duration::millis

The duration::millis function counts how many milliseconds fit into a duration.

API DEFINITION
duration::millis(duration) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::millis(3w);

1814400000

duration::mins

The duration::mins function counts how many minutes fit into a duration.

API DEFINITION
duration::mins(duration) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::mins(3w);

30240

duration::nanos

The duration::nanos function counts how many nanoseconds fit into a duration.

API DEFINITION
duration::nanos(duration) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::nanos(3w);

1814400000000000

duration::secs

The duration::secs function counts how many seconds fit into a duration.

API DEFINITION
duration::secs(duration) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::secs(3w);

1814400

duration::weeks

The duration::weeks function counts how many weeks fit into a duration.

API DEFINITION
duration::weeks(duration) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::weeks(3w);

3

duration::years

The duration::years function counts how many years fit into a duration.

API DEFINITION
duration::years(duration) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::years(300w);

5

duration::from::days

The duration::years function counts how many years fit into a duration.

API DEFINITION
duration::from::days(number) -> duration

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::from::days(3);

3d

duration::from::hours

The duration::from::hours function converts a numeric amount of hours into a duration that represents hours.

API DEFINITION
duration::from::hours(number) -> duration

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::from::hours(3);

3h

duration::from::micros

The duration::from::micros function converts a numeric amount of microseconds into a duration that represents microseconds.

API DEFINITION
duration::from::micros(number) -> duration

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::from::micros(3);

3μs

duration::from::millis

The duration::from::millis function converts a numeric amount of milliseconds into a duration that represents milliseconds.

API DEFINITION
duration::from::millis(number) -> duration

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::from::millis(3);

3ms

duration::from::mins

The duration::from::mins function converts a numeric amount of minutes into a duration that represents minutes.

API DEFINITION
duration::from::mins(number) -> duration

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::from::mins(3);

3m

duration::from::nanos

The duration::from::nanos function converts a numeric amount of nanoseconds into a duration that represents nanoseconds.

API DEFINITION
duration::from::nanos(number) -> duration

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::from::nanos(3);

3ns

duration::from::secs

The duration::from::secs function converts a numeric amount of seconds into a duration that represents seconds.

API DEFINITION
duration::from::secs(number) -> duration

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::from::secs(3);

3s

duration::from::weeks

The duration::from::days function converts a numeric amount of weeks into a duration that represents weeks.

API DEFINITION
duration::from::weeks(number) -> duration

The following example shows this function, and its output, when used in a RETURN statement:

RETURN duration::from::weeks(3);

3w