13
Views
2
Comments
CurrDateTime() does not take DST into account
Question

Hi, 

I've been using the CurrDateTime() function and have noticed that in both a client and server action in a mobile/react application the CurrDateTime() has not taken DST into consideration. Therefore, times are 1hour behind.

Is this a bug? Thanks

mvp_badge
MVP
Rank: #18

Hello Janet,

Abstract from  Available data types - Date Time Notes:

  • When you work with Date Time data type in the server, you always deal with the time zone of the server (UTC for cloud environments hosted by OutSystems).
  • Date Time in mobile apps is always UTC, even when requested from the server.
  • When you use Date Time in the mobile app UI, the value is converted to the local time of the device.

Here is an example for a server that is in GMT+01 (Paris) and a mobile device in GMT-05 (New York). The mobile device requests a certain Date Time value from the server, for example #2007-12-18 17:00:00#. What happens is:

  1. The value is converted by the server to UTC #2007-12-18 16:00:00# and sent to the mobile device.
  2. When you store the value in the mobile app, the value is handled as UTC and saved as #2007-12-18 16:00:00#.
  3. When you display the value in the UI, the end users see #2007-12-18 11:00:00#.

If you do not need this scenario in your logic, use data types Date and Time separately to deal with the respective values.

If you want to display the current date/time client-side for a Platform server calculated time, you either need to use JavaScript, or something like the Time Zone Forge Component.

Regards,

Daniel