Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Server basic translations for AT TIME ZONE #26971

Closed
roji opened this issue Dec 12, 2021 · 0 comments · Fixed by #26972
Closed

SQL Server basic translations for AT TIME ZONE #26971

roji opened this issue Dec 12, 2021 · 0 comments · Fixed by #26972
Assignees
Labels
area-query area-sqlserver closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@roji
Copy link
Member

roji commented Dec 12, 2021

Based on the general support for AT TIME ZONE added in #26199, add some basic SQL Server translations. Note that SQL Server's AT TIME ZONE can accept either a datetime/datetime2 or a datetimeoffset, and always returns a datetimeoffset.

.NET SQL
EF.Functions.AtTimeZone(datetimeoffset, "UTC") datetimeoffset AT TIME ZONE 'UTC'
EF.Functions.AtTimeZone(datetime, "UTC") datetime AT TIME ZONE 'UTC'

Note: there's also DateTimeOffset.ToOffset which can translate to SQL Server SWITCHOFFSET, but SWITCHOFFSET accepts a text expression (+08:00) whereas .NET ToOffset accepts a TimeSpan. Leaving this for now. Same goes for new DateTimeOffset(dateTime, offset) and TODATETIMEOFFSET.

@roji roji added this to the 7.0.0 milestone Dec 12, 2021
@roji roji self-assigned this Dec 12, 2021
roji added a commit to roji/efcore that referenced this issue Dec 12, 2021
roji added a commit to roji/efcore that referenced this issue Dec 12, 2021
@roji roji added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Dec 12, 2021
roji added a commit to roji/efcore that referenced this issue Dec 14, 2021
roji added a commit to roji/efcore that referenced this issue Jan 12, 2022
roji added a commit to roji/efcore that referenced this issue Jan 19, 2022
roji added a commit to roji/efcore that referenced this issue May 24, 2022
roji added a commit to roji/efcore that referenced this issue May 24, 2022
roji added a commit to roji/efcore that referenced this issue May 24, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, 7.0.0-preview5 May 25, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0-preview5, 7.0.0 Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query area-sqlserver closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants