List of usage examples for java.util TimeZone getID
public String getID()
From source file:com.jaspersoft.jasperserver.war.common.JdkTimeZonesList.java
protected StringOption createOption(Locale userLocale, TimeZone tz) { String description = getTimeZoneDescription(tz, userLocale); StringOption option = new StringOption(tz.getID(), description); return option; }
From source file:it.jugpadova.controllers.JuggerEditController.java
@ModelAttribute("timezones") protected List<TimeZoneBean> getTimezones(HttpServletRequest req) throws Exception { RequestContext rc = (RequestContext) req.getAttribute("requestContext"); List<TimeZoneBean> timezones = new ArrayList(); Date now = new Date(); String[] tzIds = TimeZone.getAvailableIDs(); for (Object otzId : tzIds) { String tzId = (String) otzId; TimeZone fdtz = TimeZone.getTimeZone(tzId); timezones.add(new TimeZoneBean(fdtz.getID(), fdtz.getID())); }/* ww w .j a v a 2 s . c o m*/ Collections.sort(timezones); return timezones; }
From source file:org.sipfoundry.sipxconfig.device.DeviceTimeZone.java
public void setTimeZone(TimeZone tz) { String tzn = tz.getID(); m_useDaylight = tz.useDaylightTime(); m_offset = tz.getRawOffset() / (int) DateUtils.MILLIS_PER_MINUTE; m_dstSavings = tz.getDSTSavings() / (int) DateUtils.MILLIS_PER_MINUTE; // Until there is a setting for DST rule, it must be guessed here based on the timezone // name/*from ww w. j ava2 s . c o m*/ // // XCF-977 - Doing string compares on ID is not predicable! On my gentoo system, I get // US/Eastern but on a FC4 machine I get America/New_York. Both running java1.5.0.06 // We'll wait for XCF-874 to address this properly. Until then, do not break whatever // seems to work for some systems in Europe, but default everyone else to US. Otherwise // the default of zero is not very helpful // See also: http://en.wikipedia.org/wiki/List_of_zoneinfo_time_zones if (tzn.matches("^Europe/.*")) { setDstParameters(DST_EU); } else { setDstParameters(DST_US); } }
From source file:com.jaspersoft.jasperserver.war.common.JdkTimeZonesList.java
public String getDefaultTimeZoneID() { TimeZone existingTz = findExistingDefaultTZ(); if (existingTz == null) { existingTz = getSystemDefault(); }/*w w w . ja v a 2s . co m*/ return existingTz.getID(); }
From source file:io.ionic.links.IonicDeeplink.java
private String getTimeZoneID() { TimeZone tz = TimeZone.getDefault(); return (tz.getID()); }
From source file:pt.lsts.neptus.util.tid.TidReader.java
/** * Parses the comment lines for harbor info and time zone. * @param line/*from w w w . j a va 2 s .co m*/ */ private void processComment(String line) { if (asReadTheHarborInfo && asReadTheTimeZoneInfo) return; if (isCommentLine(line)) { if (!asReadTheHarborInfo) { String val = extractValueWithHeader(line, TidWriter.HARBOR_STR); if (val != null && !val.isEmpty()) { harbor = val; asReadTheHarborInfo = true; return; } } if (!asReadTheTimeZoneInfo) { String val = extractValueWithHeader(line, TidWriter.TIMEZONE_STR); if (val != null && !val.isEmpty()) { TimeZone tz = TimeZone.getTimeZone(val); if (tz.getID().equalsIgnoreCase(val)) { dateTimeFormatterUTC.setTimeZone(tz); dateTimeFormatterUTC2.setTimeZone(tz); } else { NeptusLog.pub().error("Error processing time zone, using UTC."); } asReadTheTimeZoneInfo = true; return; } } } }
From source file:com.jaspersoft.jasperserver.war.common.JdkTimeZonesList.java
protected TimeZone findExistingDefaultTZ() { TimeZone defaultTz = getSystemDefault(); TimeZone existingTz = null;//from w w w .j a v a 2 s . com for (Iterator it = timeZonesIds.iterator(); it.hasNext();) { String id = (String) it.next(); if (id.equals(defaultTz.getID())) {//exact match existingTz = defaultTz; break; } else if (existingTz == null) { TimeZone timeZone = loadTimeZone(id); if (defaultTz.hasSameRules(timeZone)) { existingTz = timeZone; } } } return existingTz; }
From source file:ch.qos.logback.core.pattern.parser2.PatternParser.java
private static DateFormat parseDateFormat(String option) { TimeZone tz = null; // default to ISO8601 if no conversion pattern given if (option == null || option.isEmpty() || option.equalsIgnoreCase(CoreConstants.ISO8601_STR)) { option = CoreConstants.ISO8601_PATTERN; }//from w w w .j av a 2s . com // Parse the last option in the conversion pattern as a time zone. // Make sure the comma is not escaped/quoted. int idx = option.lastIndexOf(","); if ((idx > -1) && (idx + 1 < option.length() && !ParserUtil.isEscaped(option, idx) && !ParserUtil.isQuoted(option, idx))) { // make sure the string isn't the millisecond pattern, which // can appear after a comma String tzStr = option.substring(idx + 1).trim(); if (!tzStr.startsWith("SSS")) { option = option.substring(0, idx); tz = TimeZone.getTimeZone(tzStr); if (!tz.getID().equalsIgnoreCase(tzStr)) { logger().warn("Time zone (\"{}\") defaulting to \"{}\".", tzStr, tz.getID()); } } } // strip quotes from date format because SimpleDateFormat doesn't understand them if (option.length() > 1 && option.startsWith("\"") && option.endsWith("\"")) { option = option.substring(1, option.length() - 1); } DateFormat format = new SimpleDateFormat(option); format.setLenient(true); if (tz != null) { format.setTimeZone(tz); } return format; }
From source file:com.aliyun.odps.ship.common.RecordConverter.java
public RecordConverter(TableSchema schema, String nullTag, String dateFormat, String tz, String charset) throws UnsupportedEncodingException { this.schema = schema; this.nullTag = nullTag; if (dateFormat == null) { this.dateFormatter = new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT_PATTERN); } else {/*from w ww . ja va 2 s.co m*/ dateFormatter = new SimpleDateFormat(dateFormat); } dateFormatter.setLenient(false); if (tz != null) { TimeZone t = TimeZone.getTimeZone(tz); if (!tz.equalsIgnoreCase("GMT") && t.getID().equals("GMT")) { System.err.println( Constants.WARNING_INDICATOR + "possible invalid time zone: " + tz + ", fall back to GMT"); } dateFormatter.setTimeZone(t); } doubleFormat = new DecimalFormat(); doubleFormat.setMinimumFractionDigits(0); doubleFormat.setMaximumFractionDigits(20); setCharset(charset); r = new ArrayRecord(schema.getColumns().toArray(new Column[0])); nullBytes = nullTag.getBytes(defaultCharset); }
From source file:br.edu.ufcg.supervisor.SupervisorInterface.java
public String getTimeZoneID() { TimeZone tz = TimeZone.getDefault(); return (tz.getID()); }