The ToString value should support 24 hours, so it should have capital HH: .ToString("yyyyMMddTHHmmssfffffffZ") eg. 02:00:00PM should become ..140000 since UTC is timezone-agnostic
– Anders RaskJan 12 '15 at 14:43
This works great! PowerShell -NoProfile -ExecutionPolicy Bypass -Command "((get-date).ToUniversalTime()).ToString(\"yyyy-MM-ddTHH:mm:ss+0000\")"
– Jay Taylor9 secs agoedit
TheCoordinatedUniversalTime(UTC) is equal to the local time minus the
UTC offset.For more information about the UTC offset, see TimeZone.GetUtcOffset.The conversion also takes into account the daylight saving time rule that applies
to the time represented by the current DateTime object.