DateTime to ISO8601
$offset = ([System.TimeZoneInfo]::Local).BaseUtcOffset.ToString() $offset = $offset.Substring(0,$offset.LastIndexOf(':')) $date.ToString("yyyy-MM-ddTHH:mm:ss.fff") + $offset
DateTime to ISO8601UTC
$date.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ")