Thanks @guptast it did show the date as formatted but the time zone is off. But if I use toLocalTime() in API step (Set Value step), it works fine. But the dynamic data is static. I will look deeper into other date & timezone settings see if I screwed up somewhere.
Is the datetime in your screenshot 2023-12-12T05:12:00.000Z showing the correct UTC time or is it showing the local time the datetime was recorded? Please post the local formatted time as well.
The date was entered manually into the database using INSERT, not the actual time from the app as entered. It is just to test the different time zone conversion from UTC. Local formatted time is 12/14/2023 12:47 as of this writing.
The datetime values returned from the database will append the time zone Z offset. If the datetime has been saved in the database in UTC, then you can format the datetime value in the UI just by adding the date formatter. However, if the datetime values are saved in the local time, then you will need to remove the time zone offset on the front end.
So, the code expression will be like this DATETIME.replace('Z', '').formatDate('dd-MM-yyyy')
For clarity, my goal is: The datetime in the database is in UTC. Different client on different timezones should be able to display the date time correctly (automatically adjusted) as per their current timezone setting.