/ Published in: C#
Well, there is many faulty C# timestamp handling codes.
Here is a proper one, use UtcNow instead Now if you need UTC timestamp...
Here is a proper one, use UtcNow instead Now if you need UTC timestamp...
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Find unix timestamp (seconds since 01/01/1970) long ticks = DateTime.UtcNow.Ticks - DateTime.Parse("01/01/1970 00:00:00").Ticks; ticks /= 10000000; //Convert windows ticks to seconds timestamp = ticks.ToString();