Getting current GMT time


Question

Is there a method in C# that returns the UTC (GMT) time zone? Not based on the system's time.

Basically I want to get the correct UTC time even if my system time is not right.

1
41
3/12/2012 3:37:39 PM

Instead of calling

DateTime.Now.ToUniversalTime()

you can call

DateTime.UtcNow

Same thing but shorter :) Documentation here.

37
3/12/2012 3:30:46 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon