A C# app I'm doing needs "Universal Coordinated Time" since 01/01/2000 in seconds and in hex (4 bytes big endian). So far I have found everything else and not what I'm needing. It seems that no one else is doing this or it would be somewhere easy to find.
tfcsd Tuesday, October 13, 2009 2:44 PM
TimeSpan ts = DateTime.UtcNow - new DateTime(2000, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); byte[] big = BitConverter.GetBytes((int)ts.TotalSeconds); Array.Reverse(big); Hans Passant.
Marked As Answer bytfcsdTuesday, October 13, 2009 3:50 PM
nobugz Tuesday, October 13, 2009 3:25 PM
You can get the seconds since 1/1/2000 via:
DateTime now = DateTime.Now.ToUniversalTime(); // Convert to "Coordinated Universal Time"
DateTime origin = new DateTime(2000,1,1); // 1/1/2000
TimeSpan difference = now - origin;
int secondsSinceJan2000 = (int)difference.TotalSeconds; // Convert to 4 byte integerint secondsSinceJan2000BigEndian = System.Net.IPAddress.HostToNetworkOrder(secondsSinceJan2000);