DateTimeToDate / DateTimeToTime

It seems there is a difference between DateTimeTo Date or Time conversion functions on Database and on client side for reactive web apps.

We take a look at #2020-4-22 23:30:23#. Since I am in GMT +2 this would be 23.4.2020 at 1:30:23.

Now for the conversion functions: If we use a calculated attribute in an aggregate to extract date or time the extracted values in the entry will be:

22.4.2020 and 23:30:23

However on client side:

23.4.2020 and 1:30:23

I think I understand where this is coming from. The DateTimeTo function gives the date and time from the respective system it is executed on. So if we use a calculated attribute this calculation happens on server side. Sadly it is a pain to deal with on client side. 

For our reactive web app I will use a client action onAfterFetch to calculate the values on client side.

Solution

Hello Philipp,

You are absolutely correct. A server side function assume the date / time of the server where the code is executed on. A client side function runs in the device / browser and it assumes the date / time of that specific device or browser.


CurrDateTime() In client-side calls, it returns the device date and time.
 In server-side calls, it returns the platform server date and time.
 In query calls, it returns the platform server date and time.

 Date times in the device are converted in the server to the server time zone.
 Likewise, date times in the server are converted to the server time zone.



So, if you send a date time with from the client to the server, it will store the value in the server database with the respective conversion.


Kind regards,

Rui Barradas

Solution