I have been trying to set a Datacard update value to the current day by using the Today() or Date() functions in conjunction with Now() function where necessary. The problem I have been having is the date is always showing the previous day with a time of 23:00. Is there something default that can cause date values to write the previous date and not the current date?
What time zone are you in? I suspect the problem is that dates are always stored in UTC but displayed in the user's local time zone. So I assume you are in a Timezone that is one hour off UTC and that is the problem. Because if you input just a date you will normally store that as that date at midnight. If you then display it in the local timezone it shows up as yesterday at 11:00PM
I had no time to look deeply into it yet, but I also saw today that the records I create via NewForm with date datacard have the date of yesterday.
I store date without time. So I cannot see how many hours the records are away from the actual date. I have to play a bit for more information.
Sitting in Germany. We are two hours ahead of UTC at the moment.
The problem is you can't store the date without a time component. Even if you save a DateOnly field it actually gets saved in the database behind SharePoint as a Date/Time value. As I said if you store just the date then it will default to taht date at midnight. I can't explain the 2 hours ahead versus 1 hour difference, but I can guarantee that the issue revolves around not adjusting for timezone and saving dateOnly dates.
I did not want to disagree with you. I am sure it is about the saving in different time zones. I just wanted to mention my experience, because it might be not as easy to explain as it sounds in your first reply.
By the way, I am using CDS.
Anyways, I will go into the details with my app and share the results here.
I totally agree that its not easy to wrap your head around this issue. I still struggle with getting it to work right all the time.
Just wanted to come to this topic for telling you, what fixed the issue for me.
It might not be helpful for you, because you want to store time as well.
However, in the advanced options of my field with data type "date only" I changed the Behavior to "date only". Afterwards, the right date gets stored without any time.
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
Check out the winners of the recent 'Can You Solve These?' community challenge!
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Featuring samples like Return to the Workplace and Emergency Response Applications
Features releasing from October 2020 through March 2021