Share via


DateTimeUtil.ToUniversalTime Method

Definition

Overloads

ToUniversalTime(DateTime)

Converts the specified DateTime to UTC if it is not already in UTC.

ToUniversalTime(Nullable<DateTime>)

Converts the specified DateTime to UTC if it is not already in UTC.

ToUniversalTime(DateTime)

Converts the specified DateTime to UTC if it is not already in UTC.

public static DateTime ToUniversalTime (DateTime value);
static member ToUniversalTime : DateTime -> DateTime
Public Shared Function ToUniversalTime (value As DateTime) As DateTime

Parameters

value
DateTime

The DateTime to convert.

Returns

The converted DateTime in UTC.

Applies to

ToUniversalTime(Nullable<DateTime>)

Converts the specified DateTime to UTC if it is not already in UTC.

public static DateTime? ToUniversalTime (DateTime? value);
static member ToUniversalTime : Nullable<DateTime> -> Nullable<DateTime>
Public Shared Function ToUniversalTime (value As Nullable(Of DateTime)) As Nullable(Of DateTime)

Parameters

value
Nullable<DateTime>

The DateTime to convert.

Returns

The converted DateTime in UTC, or null if value is null.

Applies to