time_t to C# DateTime class

  • Thread starter Thread starter Claire
  • Start date Start date
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
 
int t= 1070390676; // value of time_t
System.DateTime dt= new System.DateTime(1970,1,1).AddSeconds(t);
 
Back
Top