How do Ihandle multi time zone users?

I am working on a solution that will have several users connecting to it from different time zones. I am wondering what will happen when dates and times are entered in to the database. Will they reflect the current users location or will they be normalized to one time zone where the server is?

If it is not based on client location then are the times based on the SQL backend time zone location or the Servoy server zone?

If they are local zone based how will that look to the users when records have dates or times in the future? Or when users create records at about the same time but the times are grossly different.

How would I sort records by date or time if they are scattered across all time zones?

Thanks

Application / getServerTimeStamp should solve the problem as all Clients will then be using the same timezone.

Graham Greensall
Worxinfo Ltd

Servoy gives you the possibility to use either the server’s timezone or the clients timezone. In most cases you will want to use the clients timezone I think. If users fill in dates for other timezones than their own it is a good idea to also include the timezone in your date/time display so that the user is aware of it.

grahamg:
Application / getServerTimeStamp should solve the problem as all Clients will then be using the same timezone.

Thanks. Is this function based on the Servoy server’s time?

jaleman:
If users fill in dates for other timezones than their own it is a good idea to also include the timezone in your date/time display so that the user is aware of it.

I am not sure if I follow you. So you are saying to have two different date/time fields, one for other time zones and one for your own.

I am just confused how to handle the date/time display and sorting of this information for the user.

Has anyone made a solution that crosses multiple time zones and where the date/time information is important?

You can use CTRL + N to move a sample of any function with sample code and explanations:

//Returns a date object initialized on server with current date and time
var servertime = application.getServerTimeStamp();

//Returns a date object initialized in client with current date and time
var clienttime = application.getTimeStamp();

To test you could change your Client computer date then use the two functions above.

I assume Jan was suggesting that it would be useful for Clients to also see the local time an email was sent rather than just the Server time - as the Server time might show 03:40 when local time was 10:40. However to ensure that all records were stored in creation time order you would use the ServerTime field

HTH

Graham Greensall
Worxinfo Ltd

We are a good example ourselves of multi timezone: we have an office in NL and in LA (9 hours apart) and we do webinars to any timezone. To enable that we do the following:

  • Dates and times are entered with timezone
  • on website we use the webbrowser locale to display the time of the event in the local time

The above is just an example any possible combination is possible in Servoy; on the lowest level all datetimes are stored in GMT and how you represent/input them is totally up to you. By default input and ouput is in the users (CLIENT) timezone eg: if you stick a plain datetime field on a screen it will use the users local timezone, in the database however it is still stored WITH timezone. As I suggested earlier: if you work cross timezone it is a good idea to display the timezone with the date so that users are aware of this. Example of confused user (myself using Outlook) while in Holland I create an appointment I have with somebody in Los Angeles at 4 PM, week later I fly to LA, adjust my timezone on my notebook and all of a sudden the appointment is at an entirely different time! Lesson: Create timezone awareness if you run cross timezones. I turned on timezone display in my agenda now so I can schedule correctly.

In short remember:

-In the database all datetimes are stored GMT
-by default at display/input these GMT times are mapped to the users timezone
-Servoy provides functions to allow you to display the timezone allong with the time
-If you schedule events cross timezone make sure your users are ‘aware’

jaleman:
In short remember:

-In the database all datetimes are stored GMT
-by default at display/input these GMT times are mapped to the users timezone
-Servoy provides functions to allow you to display the timezone allong with the time
-If you schedule events cross timezone make sure your users are ‘aware’

Ah, I think I got now. The server stores the times as GMT. But I as a developer have to set all my date/time fields in the user interface to convert those fields into local time zones.

So if current GMT is 12:00 and the user in California enters a time then they will see 04:00 am.

Ok this makes more since.

Thanks.