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.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.0.0-rc.1
C#
public static DateTime AsUtc(
	this DateTime dateTime
)

Parameters

dateTime  DateTime
The DateTime to convert.

Return Value

DateTime
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