-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all,
i wanted to ask a question about the timezone and the calendars
I’m using the zk version 3.6.3.
By default it gets the timezone from California … I have tried adding the rome time zone (so I can see the two columns) but still the hours on the left side starts from 00:00.
What shall I do to correctly display it around the current time?
The setTimeZone wants a string as a value … I have tried putting different values … but I get an exception of array index bound exception …
Thanks
Kar
The main timezone always start at 00:00
you can call setTimeZone("California=GMT-8")
Hope is not too last to ask still a bit of help ...
here is what i have done ...
org.zkoss.calendar.Calendars cals = (org.zkoss.calendar.Calendars) calendarWin
.getVariable("cal", false);
Map zone = cals.getTimeZones();
if (!zone.isEmpty()) {
Iterator iterator = zone.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry me = (Map.Entry) iterator.next();
// Remove default timezone
cals.removeTimeZone((TimeZone) me.getKey());
}
}
// Add Rome as timezone
cals.addTimeZone("Roma", TimeZone.getTimeZone("Europe/Rome"));
cals.setTimeZone("California=GMT-6"); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
so what i do is to remove all time zone from the calendar ...
i have tried different combination ... but
if i had just the addTimeZone (rome ... ) i still see the calendar starting from zero ...
if I had only the second line i get the calendar with name California but still starting from zero ...
if i use both the line i get the first column Roma starting from zero and the second California starting from 16
still do not understand what i'm doing wrong
thanks agains
kar
You can see that they do the same thing
public void addTimeZone(String label, TimeZone timezone) { if (label == null) label = ""; _tzones.put(timezone, label); if (!inMonthMold() && _dfmter != null){ Calendar cal = Calendar.getInstance(getDefaultTimeZone()); cal.set(Calendar.MINUTE, 0); smartUpdate("captionByTimeOfDay", Util.encloseList(Util.packCaptionByTimeOfDay(cal, _tzones, Locales.getCurrent(), _dfmter))); } TimeZone tz = getDefaultTimeZone(); smartUpdate("tz", (tz.getRawOffset() + (tz.useDaylightTime() ? tz.getDSTSavings() : 0))/60000); smartUpdate("bd", getBeginDate().getTime()); smartUpdate("ed", getEndDate().getTime()); reSendEventGroup(); } public void addTimeZone(String label, String timezone) { addTimeZone(label, TimeZone.getTimeZone(timezone)); } public void setTimeZone(String timezone) { if (timezone == null) throw new IllegalArgumentException("The timezone is null!"); for (String timezoneString : timezone.trim().split(",")) { String[] pair = timezoneString.split("="); addTimeZone(pair[0].trim(), pair[1].trim()); } }
and it will call for loop to draw time zone column
the first element will show start with 00:00
so, which are you want to be base time that start from 00:00 ?
California?
you have to add time zone in you want sequence
Asked: 2009-12-31 07:46:26 +0800
Seen: 621 times
Last updated: Feb 05 '10