System Namespace DateTime Structure
Returns a DateTime that is the current local date and time on this computer expressed as the coordinated universal time ( UTC ).
[ VB ]
<Serializable>
Public Shared ReadOnly Property UtcNow As DateTime
[ C# ]
[ Serializable ]
public static DateTime UtcNow { get; }
[ C++ ]
[ Serializable ]
public: __property static DateTime get_UtcNow ( );
[ JScript ]
public Serializable
static function get UtcNow ( ) : DateTime;
A DateTime whose value is the current UTC date and time.
The resolution of this property depends on the system timer.
System |
Approximate Resolution |
Windows NT 3.5 and later |
10 milliseconds |
Windows NT 3.1 |
16 milliseconds |
Windows 98 |
55 milliseconds |
NOTE: DateTime.UtcNow returns the same value as invoking TimeZone.CurrentTimeZone.ToUniversalTime ( DateTime.Now ).
The following example gets the value returned by UtcNow on the server to determine the current local time of a user's browser based on the time zone offset obtained from the client as the page loads.
DateTime Members GetUtcOffset