Overview
Returns the next valid date time by calendar rules after adding given duration.DateTimeOffset myCalendar.GetDateTime(duration: string, offset: ( Date | DateTimeOffset ))
Arguments
string duration
Duration in the "d.hh:mm:ss" or ISO-8601 duration format
( Date | DateTimeOffset ) offset
Specifies the offset value for relative date time. Optional, if not specified current date time is used.
Returns
The next valid date time by calendar rules.Remarks
This method adds the duration to given to offset or current date and then finds the next business date time by calendar rules. Resulting value may be not exactly added duration. If just need to add duration in business hours, please use Calendar.AddTimeSpan method instead.
Duration This method adds the duration standard calendar and returns the next business date time.
Example
For 09:00-18:00 business hours, adding 2 hours to 17:00 results next day 09:00 not 10:00
var nextDate = $Calendar.GetDateTime('PT2H', DateTimeOffset.parse('2023-02-08T17:00')); // nextDate will be set to '2020-02-09T09:00'