1

I'm getting time and date in timestamp format. For example, for date and time of 4/3/2018 3:06:03 AM, I'm getting timestamp value 43193.12920166. I want to convert it to yyyyMMddHHmmss.

MG78
  • 219
  • 2
  • 5
  • 12

1 Answers1

6

Unix timestamp - is amount of seconds from 1/1/1970, so just calc it:

static DateTime ConvertFromUnixTimestamp(double timestamp)
{
    DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0);
    return origin.AddSeconds(timestamp);
}
Backs
  • 24,430
  • 5
  • 58
  • 85