Current Time Hours For Java - CSharp System

CSharp examples for System:DateTime Hour

Description

Current Time Hours For Java

Demo Code


using System.Runtime.InteropServices;
using System;//from   www . j a  v a2  s.  c  o  m

public class Main{
        public static long CurrentTimeHoursForJava()
        {
            DateTime baseline = new DateTime(1970, 1, 1, 0, 0, 0);
            TimeSpan ts = new TimeSpan(DateTime.UtcNow.Ticks - baseline.Ticks);

            return ((long) ts.TotalMilliseconds/3600000L);
        }
}

Related Tutorials