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.
The Greenwich Mean Time corresponds to the time zone UTC 0, i.e. the Coordinated World Time with an offset of 0 hours. It essentially corresponds to Western European time, which is valid in Portugal, for example, but is officially referred to as GMT in the United Kingdom and several African countries.
Please note: GMT is currently not observed in the UK.
The term GMT should thus not be used for purposes that require precision. Because of Earth's uneven angular velocity in its elliptical orbit and its axial tilt, noon (12:00:00) GMT is rarely the exact moment the Sun crosses the Greenwich Meridian and reaches its highest point in the sky there.
Instead of calling
DateTime.Now.ToUniversalTime()
you can call
DateTime.UtcNow
Same thing but shorter :) Documentation here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With