Skip to content

Modern Chrono TimeSpan Add

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

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

TimeSpan.Add

Returns the sum of two durations, or Invalid on overflow.

Syntax

TimeSpan.Add

Examples

#import "std/chrono"
using chrono

dim as TimeSpan a = TimeSpan( 1, 0, 0 )
dim as TimeSpan b = TimeSpan( 0, 30, 0 )

print a.Add( b ).ToIsoString( )          '' PT1H30M

'' IMMUTABLE -- a new value comes back and the receiver is untouched
a.Add( b )
print a.ToIsoString( )                    '' PT1H, unchanged

'' Overflow yields Invalid; it never wraps
print TimeSpan.MaxValue( ).Add( a ).IsValid       '' false

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

Clone this wiki locally