CSharp examples for System:DateTime Unix
Get Unix Timestamp From Local Time
using System.Web; using System.Linq; using System.Collections.Generic; using System;/*from www . j a v a 2 s . com*/ public class Main{ public static string GetUnixTimestampFromLocalTime(DateTime? dt=null) { if(dt==null) { dt=DateTime.Now; } DateTime basetime= new DateTime(1970, 1, 1, 0, 0, 0, 0); return Math.Floor((dt.Value.ToUniversalTime()-basetime).TotalSeconds).ToString(); } }