Date Time To Unix Time - CSharp System

CSharp examples for System:DateTime Unix

Description

Date Time To Unix Time

Demo Code


using System.Globalization;
using System.Reflection;
using System.Xml;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from   w  w  w.j a  v  a2s  .com

public class Main{
        public static double DateTimeToUnixTime(DateTime date)
        {
            var univ = date.ToUniversalTime();
            var diff = univ - Epoch;

            return diff.TotalSeconds;
        }
}

Related Tutorials