Here’s what’s happening in my app:
UI: DateTime Picker has the user pick the date only
Database: Stores the correct date and adds a time based on the current time
Retrieve: The date is always correct on the Information page using a Find Operation
Here’s the issue:
API: The back-end API service will add 1 day if the DATETIME is around 8:00 p.m. or later. I’m guessing this is an issue with time zones where the server is interpreting to a different time zone than the UI builder?
-David
The database data type is DATETIME
, which means the time component will always be there. To avoid the timezone conversion issues, set the time for the selected date to 00:00:00 before saving the value in the database.
Regards,
Mark
Got it. That is one solution I was thinking of, but couldn’t seem to figure out how to set the time. There’s a “set time” block, but am I supposed to put a text value in or something else?
-David
Not quite, the set time for date
block expects an integer which represents time in milliseconds. Instead, use the hours
and minutes
element of the drop-down in the same block.
I’m still misunderstanding something. I tried using the “set time for date” block with an integer, and it still didn’t work. The “set hours for date” didn’t seem to do the trick either. I don’t suppose there is a way to change the time zone for API calls universally? I have a lot of datetime pickers I’ll have to do this for individually.
If you need to modify the date that sits inside of Page Data, you need to extract the value from Page Data, put it into a variable, modify the hours/minutes, put the value from the variable back into Page Data.
Hope this helps.
For anyone else coming across this problem in a Google search, attached is the solution that worked for me. Set the “Variable” to whatever the “value logic” name is and it will (a) get that page value (2) convert it to a date format (3) set the hours to 0 (4) convert it back to a timestamp (5) update the page value.
1 Like