CSharp examples for System:DateTime Timestamp
Get time stamp since 197011 00:00:00
using System;/*from w ww . j av a 2s . c om*/ public class Main{ /// <summary> /// Get time stamp since 1970/1/1 00:00:00 /// </summary> /// <param name="dateTime"></param> /// <returns></returns> public static string GetTimeStamp(this DateTime dateTime) { TimeSpan span = dateTime - new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime(); return ((long)span.TotalSeconds).ToString(); } }