001
001

Reputation: 65137

Convert UTC time in UNIX time format to a readable DateTime format?

How to convert UTC time in UNIX time format to a normal DateTime format (that I could read)?

Example of UTC Time in UNIX time format 1292985942

Upvotes: 1

Views: 1697

Answers (2)

Raghuram
Raghuram

Reputation: 3967

You can do it in perl like this
my @temp_var = split(/ /,localtime(1292985942));

Output would be

$temp_var[0] => Wed
$temp_var[1] => Dec
$temp_var[2] => 22
$temp_var[3] => 10:45:42
$temp_var[4] => 2010

Upvotes: -2

benjy
benjy

Reputation: 4716

double timestamp = 1292985942;
DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0);
dateTime = dateTime.AddSeconds(timestamp);

Upvotes: 6

Related Questions