CSharp Millis Second To Java Long - CSharp System

CSharp examples for System:DateTime Second

Description

CSharp Millis Second To Java Long

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from w w w .j  a  v a  2s  .c o m

public class Main{
        static public long CSharpMillisToJavaLong(DateTime dateTime)
        {
            DateTime Jan1st1970 =
                new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            long diff =
                (long)(dateTime.ToUniversalTime() - Jan1st1970)
                .TotalMilliseconds;
            return diff / 1000;
        }
}

Related Tutorials