KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to convert a C# DateTime variable to Unix time, ie, the number of seconds since Jan 1st, 1970. It looks like a DateTime is actually implemented as the number of 'ticks' since Jan 1st, 0001. My current thought is to subtract Jan 1st, 1970 from my DateTime like this: TimeSpan span= DateTime.Now.Subtract(new DateTime(1970,1,1,0,0,0)); return span.TotalSeconds; Is there a better way?
Tags (comma-separated)
Save Edits
Cancel