Skip to content

Translate DateTimeOffset.ToUnixTime[Seconds|Milliseconds] #28925

New issue

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

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

Already on GitHub? # to your account

Closed
ascott18 opened this issue Aug 30, 2022 · 2 comments · Fixed by #28978
Closed

Translate DateTimeOffset.ToUnixTime[Seconds|Milliseconds] #28925

ascott18 opened this issue Aug 30, 2022 · 2 comments · Fixed by #28978
Assignees
Milestone

Comments

@ascott18
Copy link
Contributor

ToUnixTime* methods on DateTimeOffset can be translated in SQL Server as DATEDIFF(second|millisecond, '1970-01-01T00:00:00.000', [Date]).

This can even be done today verbosely with EF.Functions as EF.Functions.DateDiffSecond(DateTimeOffset.UnixEpoch, date). It would be nice if translation of ToUnixTimeSeconds/ToUnixTimeMilliseconds was supported natively.

@ajcvickers ajcvickers added this to the Backlog milestone Aug 31, 2022
@ajcvickers ajcvickers added good first issue This issue should be relatively straightforward to fix. area-query labels Aug 31, 2022
@Marusyk
Copy link
Member

Marusyk commented Sep 1, 2022

Please assign it to me

@ajcvickers
Copy link
Contributor

ajcvickers commented Sep 1, 2022

@Marusyk Feel free to submit a PR. Note that EF7 is closed for new features, so the PR should target the main branch and we will not merge it until after EF7 is closed down.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants