Skip to content

Modern Chrono TimeSpan Duration

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Date and Time (Chrono) › Chrono Date and Time › TimeSpan.Duration

TimeSpan.Duration

Returns the absolute value of the duration.

Syntax

TimeSpan.Duration

Examples

#import "std/chrono"
using chrono

dim as TimeSpan t = TimeSpan.FromHours( -2 )

'' The absolute value: how long, regardless of direction
print t.Duration( ).IsNegative           '' false
print t.Duration( ).TotalHours           '' 2

'' Already positive, so it is a no-op there
print TimeSpan.FromHours( 2 ).Duration( ).TotalHours    '' 2

Library: Chrono Date and Time
Category: Date and Time (Chrono)
Documented under: The Members

Clone this wiki locally