SqlServerDbFunctionsExtensions.AtTimeZone Method

Definition

Overloads

AtTimeZone(DbFunctions, DateTime, String)

Converts dateTime to the corresponding datetimeoffset in the target timeZone. Corresponds to the SQL Server AT TIME ZONE construct.

AtTimeZone(DbFunctions, DateTimeOffset, String)

Converts dateTimeOffset to the time zone specified by timeZone. Corresponds to the SQL Server AT TIME ZONE construct.

AtTimeZone(DbFunctions, DateTime, String)

Converts dateTime to the corresponding datetimeoffset in the target timeZone. Corresponds to the SQL Server AT TIME ZONE construct.

public static DateTimeOffset AtTimeZone (this Microsoft.EntityFrameworkCore.DbFunctions _, DateTime dateTime, string timeZone);
static member AtTimeZone : Microsoft.EntityFrameworkCore.DbFunctions * DateTime * string -> DateTimeOffset
<Extension()>
Public Function AtTimeZone (_ As DbFunctions, dateTime As DateTime, timeZone As String) As DateTimeOffset

Parameters

_
DbFunctions

The DbFunctions instance.

dateTime
DateTime

The value to convert to datetimeoffset.

timeZone
String

A valid SQL Server time zone ID.

Returns

The datetimeoffset resulting from the conversion.

Remarks

Note that the Kind of dateTime is not taken into account when performing the conversion; the offset for the provided time zone is simply applied as-is.

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to

AtTimeZone(DbFunctions, DateTimeOffset, String)

Converts dateTimeOffset to the time zone specified by timeZone. Corresponds to the SQL Server AT TIME ZONE construct.

public static DateTimeOffset AtTimeZone (this Microsoft.EntityFrameworkCore.DbFunctions _, DateTimeOffset dateTimeOffset, string timeZone);
static member AtTimeZone : Microsoft.EntityFrameworkCore.DbFunctions * DateTimeOffset * string -> DateTimeOffset
<Extension()>
Public Function AtTimeZone (_ As DbFunctions, dateTimeOffset As DateTimeOffset, timeZone As String) As DateTimeOffset

Parameters

_
DbFunctions

The DbFunctions instance.

dateTimeOffset
DateTimeOffset

The value on which to perform the time zone conversion.

timeZone
String

A valid SQL Server time zone ID.

Returns

The datetimeoffset resulting from the conversion.

Remarks

See Database functions, and Accessing SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to