Hello again!
This time I’d like to spend a moment on many times asked question, how to convert time in Powershell.
So first, let’s see how to convert a time into UTC, on which I spent a few hours in past.
$Time = [datetime]"2.10.2016 13:44:00" $FromTimeZone = [System.TimeZoneInfo]::FindSystemTimeZoneById("Central Europe Standard Time") $ConvertedTime = ([System.TimeZoneInfo]::ConvertTimeToUtc($Time, $FromTimeZone)) -f "MM/dd/yyyy HH:mm:ss" $ConvertedTime
Cool, isn’t it? But what if you need to convert it from different time zone? Just get all the possibilities displayed out
[System.TimeZoneInfo]::GetSystemTimeZones()
Have a good day,
Robot(ICT) guy