Code example for TimeZone

Methods: getRawOffset

0
                        String tzone = property.getParameter("TZID").getValue();
                        if (tzone != null) {
                            TimeZoneRegistry registry = Controller.calendarBuilder.getRegistry();
                            TimeZone z = registry.getTimeZone(tzone);
                            if (z != null) {
                                Log.d(LOG_ID, "Adjusting timezone by " + z.getRawOffset());
                                int z1 = z.getRawOffset();
 
                                // Try to convert gmt GMT-05:00 
                                int z2 = 0;
                                TimeZone currentZone = TimeZone.getDefault();
                                String dispName = currentZone.getDisplayName(true, TimeZone.SHORT);
                                if (dispName.startsWith("GMT")) {
                                    int shift = 0;
                                    if (dispName.matches("GMT[+].*")) {
                                        shift++;
                                    } 
                                    if (dispName.matches("GMT[+|-][0-9][0-9]:[0-9][0-9].*")) {
                                        z2 = Integer.parseInt(dispName.substring(3 + shift, 6)) * 3600000;
                                        z2 += ((z2 < 0) ? -1 : 1)
                                                * (Integer.parseInt(dispName.substring(7, 9)) * 60000);