Skip to content

ChangeTimeZone

Returns a new DateTimeOffset with the specified time zone offset.

1
myCalendar.ChangeTimeZone(dateTime: [DateTimeOffset](./../DateTimeOffset/index.md), timeZone: string):DateTimeOffset

Parameters

DateTimeOffset dateTime
    The base DateTimeOffset value.

string timeZone
    The new time zone offset in "hh:mm" format.

Returns

A new DateTimeOffset with the specified time zone offset.

Remarks

Change a date-time value to a different offset

1
2
3
var currentDate = $Calendar.Today;
$Xml.SetValue('CurrentDate', currentDate);
$Xml.SetValue('ChangedDate', $Calendar.ChangeTimeZone(currentDate, '02:00'));

Inspect the shifted XML output

1
2
<CurrentDate>2017-01-25T15:42:47.5389149Z</CurrentDate>
<ChangedDate>2017-01-25T17:42:47.5389149+02:00</ChangedDate>

See Also