Convert DateTimeOffset From Unix Timestamp - CSharp System

CSharp examples for System:DateTime Timestamp

Description

Convert DateTimeOffset From Unix Timestamp

Demo Code

// License:    New BSD License (BSD)

public class Main{
        public static DateTimeOffset ConvertFromUnixTimestamp(long timestamp)
		{/*www  . j  a  v a  2 s  .  c o  m*/
			DateTimeOffset origin = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, DateTimeOffset.Now.Offset);
			return origin.AddSeconds(timestamp);
		}
}

Related Tutorials