Get Unix Timestamp - CSharp System

CSharp examples for System:DateTime Unix

Description

Get Unix Timestamp

Demo Code


using System;//w  w w.ja v  a 2 s . c om

public class Main{
        public static string GetUnixTimestamp()
        {
            TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
            return ((int)t.TotalSeconds).ToString();
        }
}

Related Tutorials