time_t to C# DateTime class

C

Claire

How can I convert date-time data in time_t to C# DateTime class format?
e.g. I read in a file a time_t value of 1070390676. How can I convert it to
a DateTime?

Any help appreciated.

Thx,

Claire
 
D

Dino Chiesa [Microsoft]

int t= 1070390676; // value of time_t
System.DateTime dt= new System.DateTime(1970,1,1).AddSeconds(t);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top