Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

How to convert Unix Time to .net DateTime

From Wiki
Jump to: navigation, search

This article explains how to convert UNIX Datetime to .Net DateTime in local format.

SignpostIcon XAML 40.png
WP Metro Icon WP8.png
SignpostIcon WP7 70px.png
Article Metadata
Created: nilay.shah3nov (26 Aug 2012)
Last edited: hamishwillee (06 Sep 2013)


Unix time, or POSIX time, is a system for describing instances in time, defined as the number of seconds that have elapsed since midnight Coordinated Universal Time (UTC), January 1, 1970, not counting leap seconds. It is used widely in Unix-like and many other operating systems and file formats. It is neither a linear representation of time nor a true representation of UTC. Unix time may be checked on some Unix systems by typing date +%s on the command line.

How to Convert Unix Time to .Net System.DateTime

System.DateTime unixTime = new System.DateTime(1970,1,1,0,0,0,0, DateTimeKind.Utc);
DateTime myDate =unixTime.AddSeconds(1258598728).toLocalTime();
This page was last modified on 6 September 2013, at 05:39.
61 page views in the last 30 days.