API
@-Formulas
JavaScript
LotusScript
Reg Exp
Web Design
Notes Client
XPages
 
Input Time Control and Time Zone
I was helping out another developer with a problem recently. They had an input control for a time value and wanted to show the time zone. The control wasn't showing the time zone, and I helped him get an easy work-around.

The field was a date/time field that uses the Calendar Time Control. The field displays only the time, and is set to always display the time zone, as can be seen in figure 3. The default value for the field is @Now.

When you first compose the document, the field appears with the hour, minute, and time zone, as in figure 1. However, when you use the drop-down to pick another time, the time zone disappears. This can be seen in figure 2.

I was able to easily give the developer a work-around that, although not perfect, works pretty well.

It turns out that if you save the document without changing the @Now default value, the full date and time is stored with the document. If you change the value and save the document, the value that is saved has no date associated with it - just the time value. I think that since there's a time value only, the time zone isn't stored with the value, and that's why it won't show a time zone.

I told the developer to add an Input Translation formula to the field. The input translation formula would associate a date value with the field. Here's the formula I had the developer add:

@TextToTime(@Text(@Today) + " " + @Text(@ThisValue; "T0Z2S1"))

The formula builds a long text string of today's date and the time the user selected (the value from the current field). The time is shown with hours, minutes, and seconds ("T0"), it only shows the time ("S1"), and also includes the time zone ("Z2"). The text string of the date and time is then converted back to a Notes date/time value.

That Input Translation formula assures that there is always a date associated with the time piece. If you're going to do any math with the dates (figuring out the time difference, for example), then you might want to use @Date and hard-code a date instead of using the current date.

The only thing I've noticed with this technique (which is why I said it's not a perfect work-around), is that the time zone goes away whenever you make a change to the field. If you press F9 (document refresh) while your cursor is in the time field, the time zone appears. But as soon as you tab away from the field, the time zone goes away. It will reappear when you look at the document in read mode. The time zone being there in read mode was really the need, so this work-around helps out quite a bit.