We have a list with a few DateTime(Date only is set) columns which are created through Powershell and there's no difference between them except the name. On a custom search page REST api is used to retrieve the items from the list but for some dates the api returns the previous day. For example if the correct date is 07/07/2023T00:00:00Z(that is the time in the database), the api returns 07/06/2023T23:00:00Z. At the first moment we thought the time zone is not properly set. We changed the server time zone to be UTC. We did the same with the Regional settings for the site collection. DB and FE server is one and the same so no difference there. The most strange thing is that not all dates are incorrect and for one list item the first DateTime column shows the correct date but the second one is incorrect. In the Database all dates are stored with time 00:00:00 because the fields are Date only. The problem is in the REST api which returns wrong dates. This is the api result:
That is the result from a CAML query made through CAML builder for the same dates:
That is a result for a few items - some of them are correct and some of them are not:
We don't have any other idea what could be the problem and any help will be appreciated!