Database not dealing with hours correctly

App id: D3828E7D-B42E-B69F-FFFC-EFE55E612400

It seems like the database has weird behavior with hours. I have a column Time_ce of type Datetime, and a generated column that take the hour and minute of Time_ce. However, the generated column always show one hour less than the actual time in Timce_ce.

image

Here are the calculations of the the generated column (to make them show two digits always):
Concat(case when hour(Time_ce) in (0,1,2,3,4,5,6,7,8,9) then concat(“0”,hour(Time_ce))
else hour(Time_ce) end,“:”,case when minute(Time_ce) in (0,1,2,3,4,5,6,7,8,9) then concat(“0”,minute(Time_ce))else minute(Time_ce) end)

I have also created an API to update datetime, the updated time also always has one hour of difference with the time I entered with API. Why is this happening?

Hello @Louis,

actually, time is the same. Backendless server works in UTC, backendless console works in client timezone, here it is my example:

As you can see diff is 2 hour in backendless console, it is because my timezone is EET, which is UTC+2. I suppose your time is UTC+1

Hi @sergey.kuk thanks for the reply!

I see…Then how can I make it as it is without the auto transformation? My users are from different time zones and they can submit date themselves for other users in the same time zone.

For example user A submits 12/31/2020 08:00:00, I want the Time_ce variable to have 12/31/2020 08:00:00 and the HourSimple function to extract 08:00 as intended, because I need to display it to other users in the same area as A. If they transform the time zone automatically for it will be misleading for users. Is there any way to do this? Thanks!

Hello @Louis,

You should change the time on the client side. Server store all dates in UTC(GMT-0) zone, so you write the code on the client side which check what is current time zone and add or subtract hours. For example you client has timezone GMT+2, so you get date from server and add 2 hours