Scott Hanselman

Converting to a DateTime from time_t

August 05, 2003 Comment on this post [0] Posted in
Sponsored By

Oo! Good stuff…I need a copy for myself…

This code just went by an internal alias and I thought I’d record it here.

public static DateTime Time_T2DateTime(uint time_t)
{
    long win32FileTime = 10000000*(long)time_t + 116444736000000000;
    return DateTime.FromFileTimeUtc(win32FileTime);
}

[Brad Abrams]

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.