I had a similar requirement for one of my projects, so i did the
following. I used the following format to part date/ time in my
DateBox
DateTimeFormat.getFormat("MMM dd yyyy H:mm")
Now, with the above format, the local timezone is automatically picked
up by the DatePicker. But since DatePicker does not allow you to
select time, the time defaults to 00:00:00. I placed a drop list in my
view where the user could choose the time. On value change on the drop
list, update the date retunred by the datebox by replacing the time
with the one picked from list box.
Regards
Ashwin
On Jun 24, 4:44 pm, Eric <edimickeast...@gmail.com> wrote:
> Hello All,
>
> How can I force a GWT DateBox to choose dates in a particular time
> zone? Users off this application might be in many time zones, but,
> for this purpose, any date entered should be in "America/Denver".
> Since one of the people who enter this information works in eastern
> time the dates he enters appear a day before the date he enters. I've
> searched this list and googled in general, but I can't find how to
> override the default time zone for a DateBox.
>
> Code:
>
> Some constants universally available:
>
> public static final TimeZoneConstants timeZoneConstants =
> GWT.create(TimeZoneConstants.class);
> public static final TimeZone usMountain =
> TimeZone.createTimeZone(timeZoneConstants
> .americaDenver());
> public static final DateTimeFormat dateDtf =
> DateTimeFormat.getFormat("MM/dd/yyyy");
>
> Code that displays the date:
> String displayDate = Constants.dateDtf.format(d, usMountain)
>
> The DateBox where the date is entered:
> DateBox.DefaultFormat pickerFormat = new
> DateBox.DefaultFormat(Constants.dateDtf);
> DateBox myDb = new DateBox(new DatePicker(), null, pickerFormat);
>
> There are many places I could expect to be able to set the Time Zone:
> on the DateTimeFormat, on the DateBox.DefaultFormat, on the DateBox,
> in DateBox.getCalendarModel() . . . Any I blind? I can't see the
> method anywhere.
>
> Thanks,
> Eric
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment