Time zone issue in CurrDateTime() issue

As currdatetime() function will get 

- the client current date time when using client UI

- the server current date time when using server action (i.e UTC time zone)

- the platform current date time when using query


I feels confused with below queries. Anybody can help me?

1. What is using query? What action it is and which time zone of platform will be used?

2. I get current date time in client UI and save it into 'field A'. BTW, i execute server action to get current date time and save it into other 'field B' in the same entity. Then, these 2 fields will be have different time zone. It seems to be so weird. Is it any best practice to handle it?


Thank in advance.

Hi Jesscia,

In Query , you need to use Advance Sql 

Select Getdate() for SQL

Take Structure as Date tye.


Regards

Rahul

Thank Rahul,

What is platform current date time? UTC as server?

Hi Jessica,

OutSystems Cloud servers run in UTC timezone

If it is an On-Premise server, CurrDateTime() will return whatever timezone the server runs on. Usually it is also UTC for most servers.

Regards,

Nordin

Hi Jessica,

AFAIK the default is UTC .


Regards,

-PJ-

Thank all.

May i know what is the best practice for the below issue?

I get current date time in client UI and save it into 'field A'. BTW, i execute server action to get current date time and save it into other 'field B' in the same entity. Then, these 2 fields will be have different time zone. It seems to be so weird.


Hi Jessica,

While taking the input from the UI you need to convert it in UTC to make it same as the you get from server side function. You also need to keep in mind that the timezone may very based on the location from where the end user is accessing the application through browser.


Regards,

-PJ-

Let me just add that there is a Tech Talk tomorrow on NextStep about How to Handle Multi-Time Zone Apps.

Be sure to register for the event (for free!) and check it out!

Regards,

Nordin