Translate to PostgreSQL date_trunc
See original GitHub issuedate_trunc('week', now()::date
Looking to make a call similar to this, and can’t figure out what should be used now. I’ve also looked at EF.Property<DateTime>()
but that doesn’t seem to help.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Documentation: 15: 9.9. Date/Time Functions and Operators
Subtract timestamps (converting 24-hour intervals into days, similarly to ... date_trunc ( text , timestamp with time zone , text ) → timestamp...
Read more >Convert date over to PostgreSQL using Date_trunc
I have a date I am wanting to convert and I can't seem to switch it over to PostgreSQL format, I would like...
Read more >PostgreSQL date_trunc Function By Examples
The date_trunc function truncates a TIMESTAMP or an INTERVAL value based on a specified date part e.g., hour, week, or month and returns...
Read more >PostgreSQL to_date Function: Convert String to Date
This tutorial shows you how to use the PostgreSQL to_date function that allows you to convert a string literal to a date value...
Read more >How to extract the date from a column in Postgres
We can extract the date from a timestamp column in the following ways: The DATE() method; The ::date suffix; The TO_CHAR() method; The...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The provider does translate certain expressions with date_trunc (e.g. DateTime.Date gets translated to
date_trunc('day', ...)
, but there’s no general .NET method which is the equivalent of PostgreSQL date_trunc. We could add a translation for this under EF.Functions.In the meantime you can map it via your own DbFunction mapping:
I’m using it on a “.GroupBy()” and it don’t work.
LINQ
But i get
It fails on the groupBy, I know cause I’ve tried commenting the Select and fails anyway, but if I comment also the groupBy then it works.