×
Namespaces

Variants
Actions

How to convert Unix Time to .net DateTime

From Nokia Developer 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
CompatibilityArticle
Created: nilay.shah3nov (26 Aug 2012)
Last edited: hamishwillee (06 Sep 2013)

UNIX Time

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 08:39.
100 page views in the last 30 days.