Get Current Time Zone - CSharp System

CSharp examples for System:DateTime Timezone

Description

Get Current Time Zone

Demo Code


using System;//from  w w w . ja v a  2s . c o m

public class Main{
        public static int GetCurrentTimeZone()
        {
            DateTime now = DateTime.Now;
            DateTime time2 = now.ToUniversalTime();
            TimeSpan span = new TimeSpan(now.Ticks - time2.Ticks);
            return span.Hours;
        }
}

Related Tutorials