Return to Snippet

Revision: 28414
at July 8, 2010 03:17 by acosonic


Initial Code
//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();

Initial URL

                                

Initial Description
Well, there is many faulty C# timestamp handling codes.

Here is a proper one, use UtcNow instead Now if you need UTC timestamp...

Initial Title
Proper c# get timestamp

Initial Tags
c

Initial Language
C#