DateTimeOffsetFromParts Procedure
Creates a
DateTimeOffset for the specified year, month, day, hour, minute, second, millisecond, and UTC offset.
Declaration
function DateTimeOffsetFromParts(
year as Number, month as Number, day as Number,
hour as Number, minute as Number, second as Number,
millisecond as Number, utcOffset as TimeSpan
) as DateTimeOffset
Parameters
- year as Number — Four-digit year.
- month as Number — Month (1-12).
- day as Number — Day (1-31).
- hour as Number — Hour (0-23).
- minute as Number — Minute (0-59).
- second as Number — Second (0-59).
- millisecond as Number — Millisecond (0-999).
- utcOffset as TimeSpan — Offset from UTC.
Return value
DateTimeOffset — A new
DateTimeOffset.
Example
Code
dim x = DateTimeOffsetFromParts(2021, 3, 12, 4, 30, 0, 0, Hours(-6))
print x.DateTime
print TotalHours(x.Offset)
Output
2021-03-12 04:30:00.000
-6