Single line to do this one: –

Int32 unix = (Int32)(startTime.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;

Takes the date and removes the number of seconds that have passed since 1/1/1970

 

 

 

 

 


Discover more from

Subscribe to get the latest posts sent to your email.

Leave a comment

Trending