Skip to main content

Currently our app param SHOW_SERVER_TIME_ONLY is set to "Y" because since our users are placed and often travel all around the world, we realized it's easier for them to set a time in the application --for instance, the beginning of a labor entry on some day at 08:00 AM, because the technician started working at 8:00 local time in his current working location--, that then will be saved as 08:00 AM UTC time in the server, and then other users from any other part of the world would conveniently see "8:00 AM" in the application.

Let's consider a scenario where I'm searching for labor entries filtering the start datetime using the ">today" filter. The documentation states that the search variable "today" means "the current date with a time of 00:00", without specifying if "00:00" is in my local time zone or in UTC. Currently, regardless of the value of SHOW_SERVER_TIME_ONLY, the filter "today" works depending on my current time zone. For example, if I'm currently in the time zone UTC -07:00, searching with ">=today" yields all the records of the same day that are saved on the database with a time after 07:00 AM (UTC).

 

Is it a correct behavior that, if SHOW_SERVER_TIME_ONLY = "Y", the search variable ">today" searches entries starting from the user's current date at 00:00 local time instead of 00:00 UTC?

If so, is there a way to alter the behavior of the search variable "today" so that it searches records considering the time "00:00 UTC"?

 

Many thanks

Hi @Maikol Geromin 

Regarding your thoughts and assumptions, you are correct. These parameters will consider the client’s time zone. So the behaviour is correct.

I am not aware of any parameter that can be used and consider the server’s time zone.

I can suggest that you use an accurate search for ‘TODAY’.

For example, all records from today (25 JAN 2024) - >=25/01/2024 +<=26/01/2024

Not great UX, but this is the only option we have out of the box.

Alternatively, create a view with a calculated field and search on that field.

For example 

CREATE VIEW MY_VIEW 
AS
SELECT RECORD_ID, ROther relevant records]
CASE WHEN CREATED_DATE BETWEEN CAST(GETDATE () AS DATE)  AND  DATEADD(DAY,1,CAST(GETDATE () AS DATE)) THEN 1
ELSE 0
END AS TODAY_SEARCH
FROM MY_TABLE

Then users will search for records where TODAY_SEARCH = 1;

You can calculate also for this week, month, etc. and give other numbers or strings as values. then users will search for ‘today’ instead of 1.

I did not try this, syntax might be wrong, this is just to give you ideas.

Cheers!

 

 

 


Hi @Shneor Cheshin 

many thanks for the suggestions


Reply