user489041 user489041 - 7 months ago 42
C# Question

Get Epoch in C# for GMT

I need to get number of milliseconds from the epoch in GMT.

Can I use this for the GMT part:


What about the number of milliseconds since the epoch?

Answer Source

This should give you a TimeZone agnostic answer.

TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
double ms = t.TotalMilliseconds ;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download