Utc To Local - CSharp System

CSharp examples for System:DateTime UTC

Description

Utc To Local

Demo Code

// Copyright (c) .NET Foundation. All rights reserved.
using System.Windows.Forms;
using OpenLiveWriter.Interop.Windows;
using System.Runtime.InteropServices;
using System.Globalization;
using System.Diagnostics;
using System;//from  w ww.java  2s .  c o m

public class Main{
        public static DateTime UtcToLocal(DateTime utcTime)
        {
            System.Runtime.InteropServices.ComTypes.FILETIME utcFileTime = ToFileTime(utcTime);
            System.Runtime.InteropServices.ComTypes.FILETIME localFileTime;
            Kernel32.FileTimeToLocalFileTime(ref utcFileTime, out localFileTime);
            return ToDateTime(localFileTime);
        }
}

Related Tutorials