CSharp examples for System:DateTime Unix
Unix Timestamp To Date Time
using System;/* w w w . jav a 2 s. com*/ public class Main{ public static DateTime UnixTimestampToDateTime(this int unixTimeStamp) { var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0); dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime(); return dtDateTime; } public static DateTime UnixTimestampToDateTime(this double unixTimeStamp) { var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0); dtDateTime = dtDateTime.AddMilliseconds(unixTimeStamp).ToLocalTime(); return dtDateTime; } }