Hi Team,
In my application, I am displaying data from an external RDS database in OutSystems. The issue is that the same record shows different timestamps for users in India and the US. This occurs because OutSystems Reactive automatically converts DateTime values to the user’s local timezone.
I need a solution to either:
Display the timestamp exactly as it is stored in the RDS database (UTC format), without any automatic timezone conversion, or
Convert the CST timestamp back to UTC so that all users see a unified time.
It would be preferable to achieve this without using any Forge components.
Hello.
That is a known feature. https://success.outsystems.com/support/enterprise_customers/maintenance_and_operations/outsystems_cloud_and_time_zones/
From my experience, all users want time in their timezone.
The workarounds are the same everywhere.
The server can send as text (if it is not a datetime, can't be converted).
Or the client can apply the AddMinutes with a country variable to change the time.
This happens when an attribute of type DateTime comes from server to client in a reactive app. So most obvious option is to retrieve separately the date part and the time part, and bring them back together on client side. (i.e. place them after each other) Or, if you don't want to do anything other than display it, bring it back to the client as a text.
@Siddharth Vyas : What I have observed is that the DateTime reaches the client in UTC, and it is then converted to local time based on the user’s timezone.
Eg : When browsed in IST timezone
When browsed in CET timezone
To convert a local DateTime back to UTC, you can use the JavaScript function new Date().toISOString();
Note : DateIn and DateOut are 'Text' datatype.
You can see the result in second column ("Created On (UTC)") in the first 2 screen shots. It's same irrespective of the timezone. .
@Siddharth Vyas : Another simple ( but db heavy ) option is to transform it as Text by having a calculate attribute with the formula = DateTimeToText(Book.CreatedOn)
Correct, if you want to keep the UTC value, you convert it to text before displaying it on the screen. It's similar to creating a file have datetime fields in the server action.