Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Monday, November 4, 2013

What time is it???

Today I’m virtually delivering a class to IT pros in India, The United Kingdom, and the United States.  Time difference can be a bit of an issue.  I’m directing time based for the class in GMT (Greenwich Mean Time).  Of course since this is a PowerShell course, I’m doing this in PowerShell.

Two of the methods provided to us from the .NET framework System.DateTime is ToLocalTime and ToUniversalTime

So let’s say that I need everyone to be back in the virtual classroom in an hour and a half.  I can run this command to get the equivalent time in GMT.

((Get.Date).AddHours(1.5)).ToUniversalTime()

Let’s say that the GMT time will be 18:30.

For the class to convert the GMT time to their local time:

(Get-Date –Date “18:30Z”).ToLocalTime()

Problem solved!

No comments: