Score:0

How do I convert custom entity's created timestamp to date format on save to database for filtering by date in a View

us flag

I am using Drupal 9 I have a custom entity which I am using to log some events. In my view, I wish to add a filter to retrieve entities created between two dates. My view displays the date as dd-mm-yyyy, which is what I need it to do. However, as the created date is a timestamp, my view returns each row, as each timestamp is different. My thinking is that I either need to coerce the the created date to a different format just before it is saved to the database, or to somehow get the query to process the timestamp just to the date level and ignore the time portion. I also need to do something similar in order to get an aggregate of entered values on a specific date or between two dates

Are either of those possible? If so, is anyone able to give me some guidance as to how to achieve it?

If I am thinking along the wrong lines, is anyone able to guide me as to what I should be doing?

Many thanks.

us flag
Thanks No Sssweat. That is really helpful.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.