rakesh
rakesh

Reputation: 338

xpages and time zone

I am building apps that support users spread across multiple countries / time zones. I had two questions with timezone manipulations in xpages. Please share any tips you have to make this easier to code and maintain.

Time zone list

In notes client and traditional domino web design we have a standard timezone control that lists exhaustive timezone options. With xpages, we do not have any such control and have to resort to maintaining some config based static list on our own. This is not very desirable as it does not update when DST rules change for countries or new time zones are introduced. These apps may also be accessed via notes client so we cannot really use java tz format, it should be the notes TZ constant (Z=6$DO..).

Is there a way to show a dynamic list of notes timezone options?

Time zone conversion (notes/java)

How do you convert a notes timezone constant into its java equivalent and vice-versa?

Scenario: If a user in North America wants to know the current time in a different timezone, say X. Where X is stored in the current notes document. Can you do this conversion using SSJS code?

Currently, we are using @Texttotimeinzone and evaluating it (@Texttotimeinzone is not a SSJS function). Is there a simpler way to convert a notes tz constant to java so we can perform all date conversions using java classes?

Upvotes: 0

Views: 714

Answers (2)

Mervin Thomas
Mervin Thomas

Reputation: 1

You can include the time zone information along with the date. Initialise the date variable and use .toString() (link to documentation)

Or you can compute it in a field with JS like

var d=new Date();
d.toString()

Instead of .toString(), you can use .toUTCString().

Upvotes: 0

Simon McLoughlin
Simon McLoughlin

Reputation: 8465

The teamroom template that ships with the ExtLib has a calendar that has the option to create a meeting and specify the time zone.

check out the custom control "controlSectionTimezonePicker". It might not be exactly what your looking for but should be a good start as a working example.

Upvotes: 1

Related Questions