Convert time to UTC in Powershell

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

Published by

Lukas Vu

I started in IT with my own business since high school providing automated and centralized hosting solutions to end customers. Nowadays I'm focusing on corporate area, analyzing, managing and improving customer's IT environments. My main focus nowadays is automation and architectural improvements.

Leave a Reply

Your email address will not be published. Required fields are marked *