Прочетете на английски

Споделяне чрез


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)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

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

C#
public static DateTimeOffset AtTimeZone (this Microsoft.EntityFrameworkCore.DbFunctions _, DateTime dateTime, string timeZone);

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

Entity Framework Core 9.0 и други версии
Продукт Версии
Entity Framework Core 7.0, 8.0, 9.0

AtTimeZone(DbFunctions, DateTimeOffset, String)

Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs
Source:
SqlServerDbFunctionsExtensions.cs

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

C#
public static DateTimeOffset AtTimeZone (this Microsoft.EntityFrameworkCore.DbFunctions _, DateTimeOffset dateTimeOffset, string timeZone);

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

Entity Framework Core 9.0 и други версии
Продукт Версии
Entity Framework Core 7.0, 8.0, 9.0