# Calendars timezone

kar
66 2

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

delete retag edit

## 3 Replies

jimmyshiau
4921 5
http://www.zkoss.org/

The main timezone always start at 00:00
you can call setTimeZone("California=GMT-8")

kar
66 2

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());
}
}
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

jimmyshiau
4921 5
http://www.zkoss.org/

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) {
}

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("=");
}
}


and it will call for loop to draw time zone column
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

[hide preview]