TimeSub$

Takes two parameters, Source, Value

Description:

Subtracts the DateTime specified in the Value parameter from the Source.

The Source parameter must be either a proper time value, or a proper datetime value as supported by the [DateTime] attribute.

The Value parameter must be either a time or a datetime (time zone not supported). When specifying a datetime, a space or a T may separate the date from the time. If subtracting dates only without a time, a T must be used on the right end of the string.

The following date formats are supported by value:

The following time formats are supported by value:

Note: When working with days only, the Greg$ and Greg% functions may be preferred. To add datetime instead of subtract, see the TimeAdd$ function.

Examples:

[New] Source      = "2022-03-02 15:30"
[New] Yesterday = TimeSub$ Source, "1T"
[New] LastMonth = TimeSub$ Source, "1-T"
[New] TwoSEarlier = TimeSub$ Source, "2"
[New] TwoMEarlier = TimeSub$ Source, "2:"
[New] TwoHEarlier = TimeSub$ Source, "2::"

Html Yesterday 'equal to "2022-03-01 15:30"
Html LastMonth 'equal to "2022-02-02 15:30"
Html TwoSEarlier 'equal to "2022-03-02 15:29:58"
Html TwoMEarlier 'equal to "2022-03-02 15:28"
Html TwoHEarlier 'equal to "2022-03-02 13:30"