Basically I am trying to find a way to convert datetime of a particular timezone to other timezone while taking DST into consideration too. e.g.
What is
This solution worked well for me:
$cstzone = [System.TimeZoneInfo]::FindSystemTimeZoneById("Central Standard Time")
$csttime = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), $cstzone)
You can then manipulate the $csttime variable just like a datetime object:
Get-Date $csttime.AddHours(-1) -f "MM\dd\yyyy HH:mm:ss"
References: http://msdn.microsoft.com/en-us/library/system.timezoneinfo.converttimefromutc(v=vs.110).aspx http://technet.microsoft.com/en-us/library/ee692801.aspx