Convert Time Zone from UTC to Local time using SharePoint 2010 Power Shell script



Function Get-LocalTime($UTCTime)
{
$UTCTime = [datetime]::ParseExact($UTCTime,"MM/dd/yyyy HH:mm:ss", [System.Globalization.CultureInfo]::CurrentCulture)
$LocalTime = $UTCTime.ToLocalTime().ToString("MM/dd/yyyy HH:mm:ss")

Return $LocalTime
}
$UTCtime="04/03/2016 12:17:09"

$localTime = Get-LocalTime $UTCtime

Write-Host "UTC Time: $($DateString); Local Time: $($localTime)"

Comments

Popular posts from this blog

Sending email using Powershell script

Convert List Collection to DataTable using C#

Difference Between Site Template and Site Definition