Skip to content

Modern Chrono Instant Subtract

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

Home › Date and Time (Chrono) › Chrono Date and Time › Instant.Subtract

Instant.Subtract

Returns the date-time moved back by a TimeSpan, or Invalid past the earliest date.

Syntax

Instant.Subtract( span )

Examples

#import "std/chrono"
using chrono

dim as DateTime d = DateTime( 2026, 8, 13, 14, 30, 5, 123 )
print d.Subtract( TimeSpan.FromHours( 2 ) ).Hour  '' 12

'' Overflow past MinValue yields Invalid rather than wrapping
print DateTime.MinValue( ).Subtract( TimeSpan.FromTicks( 1 ) ).IsValid    '' false

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

Clone this wiki locally