DateTimeExtensionsAsUtc Method

Converts the specified dateTime to UTC time. Unlike DateTime.ToUniversalTime, this method does not treat DateTime instances with Unspecified Kind as local times.


Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.2.0
public static DateTime AsUtc(
	this DateTime dateTime


dateTime  DateTime
The DateTime to convert.

Return Value

A DateTime instance with Utc Kind.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DateTime. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also