[mobile] CurrDate() and CurrDateTime()


i want to ask the return value of currdatetime on mobile is from where ? 

from server or from local datetime on mobile device ?

if it's from server, how can I get the local datetime on mobile device.

thank you.


Hi Tobit,

Builtin functions such as CurrDateTime() will return the date and time from the device when they are used in the client context (either in the UI or in a client action). If they're called in a server action they will return server date and time. 


Ic, tq Joao for the information.

When we debug client actions or mobile screen actions it still shows the time in the server time (in our case UTC). Is it because the debug calls pass by the server before we see the results on the dev. studio?

And if we store the datetimes in the local storage, are they kept in server timezone or in device timezone?

I'm asking because we need to compare saved datetimes with CurrDateTime() and I want to be sure I'm comparing apples with apples.

Answer from outsystems support:

According to this article, we would like to highlight the following Date Time notes:

When you work with Date Time data type in the server, you always deal with the timezone of the server.

  • 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.

Which means that Date Times are only displayed in the timezone of the mobile device in the app UI. But everything else deals with UTC. This way, the client-side logic does not need to deal with timezone conversions.

Therefore, answering your questions:

  1. According to the previous explanation, it is expected that you see the Date Time in UTC when you debug a call to CurrDateTime() inside a Client Action. So, the timezone of the Server does not have influence in the Date Time returned.
  2. If you store the Date Times in the local storage of the device, they are kept in UTC. It is independent of the timezone of the devices and server.

Thanks for the feedback Ricardo! This is indeed the slightly confusing way in which this works. The good thing is that if you're running OutSystems in the cloud, the servers also use UTC, the downside is that there's no automatic conversion for Web as there is for Mobile.