tz.setID("GMT-\u0660\u0668:\u0660\u0660"); zone = DateTimeZone.forTimeZone(tz); assertEquals("-08:00", zone.getID());
/** * Sets the time zone ID. This does not change any other data in * the time zone object. * @param ID the new time zone ID. * @stable ICU 2.0 */ public void setID(String ID) { if (isFrozen) { throw new UnsupportedOperationException("Attempt to modify a frozen TimeZone instance."); } timeZone.setID(ID); }
@Override public void setID(String id) { super.setID(id); timeZone = TimeZone.getTimeZone(id); }
/** * Sets the time zone ID. This does not change any other data in * the time zone object. * @param ID the new time zone ID. * @stable ICU 2.0 */ public void setID(String ID) { if (isFrozen) { throw new UnsupportedOperationException("Attempt to modify a frozen TimeZone instance."); } timeZone.setID(ID); }
/** * TimeZone API; calls through to wrapped time zone. */ @Override public void setID(String ID) { super.setID(ID); zone.setID(ID); }
DateFormat dateFormat = new SimpleDateFormat("MMM dd, yyyy hh:mm aa zzz"); TimeZone defaultTimeZone = TimeZone.getDefault(); TimeZone timeZone = TimeZone.getTimeZone(""); timeZone.setID(defaultTimeZone.getID()); timeZone.setRawOffset(defaultTimeZone.getRawOffset()); dateFormat.setTimeZone(timeZone); System.out.println(dateFormat.format(new Date(1243861200000L)));
@Override public void setID(String ID) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify a frozen TimeZoneJDK instance."); } fJdkTz.setID(ID); }
/** * Constructs an adapter for a com.ibm.icu.util.TimeZone object. */ public TimeZoneAdapter(TimeZone zone) { this.zone = zone; super.setID(zone.getID()); }
class Foobar { public static void main(String[] args) { sun.util.calendar.ZoneInfo zi = sun.util.calendar.ZoneInfoFile.getZoneInfo("GMT"); zi.setID("GMT+00:00:00"); } }
/** * Build a calendar from TIMESTAMPTZWrapper. */ public static Calendar buildCalendar(TIMESTAMPTZWrapper timestampTZ) throws SQLException{ Timestamp ts = timestampTZ.getTimestamp(); TimeZone tz = timestampTZ.getTimeZone(); Calendar gCal; if(timestampTZ.isTimestampInGmt()) { gCal = Calendar.getInstance(tz); gCal.setTime(ts); } else { gCal = Calendar.getInstance(); gCal.setTime(ts); gCal.getTimeZone().setID(tz.getID()); gCal.getTimeZone().setRawOffset(tz.getRawOffset()); } return gCal; }
/** * Build a calendar from TIMESTAMPTZWrapper. */ public static Calendar buildCalendar(TIMESTAMPTZWrapper timestampTZ) throws SQLException{ Timestamp ts = timestampTZ.getTimestamp(); TimeZone tz = timestampTZ.getTimeZone(); Calendar gCal; if(timestampTZ.isTimestampInGmt()) { gCal = Calendar.getInstance(tz); gCal.setTime(ts); } else { gCal = Calendar.getInstance(); gCal.setTime(ts); gCal.getTimeZone().setID(tz.getID()); gCal.getTimeZone().setRawOffset(tz.getRawOffset()); } return gCal; }
private OperableTrigger toOperableTrigger(TriggerKey triggerKey, Map<String, String> trigger) { if (TRIGGER_TYPE_SIMPLE.equals(trigger.get(TRIGGER_TYPE))) { SimpleTriggerImpl simpleTrigger = new SimpleTriggerImpl(); setOperableTriggerFields(triggerKey, trigger, simpleTrigger); if (trigger.get(REPEAT_COUNT) != null && !trigger.get(REPEAT_COUNT).isEmpty()) simpleTrigger.setRepeatCount(Integer.parseInt(trigger.get(REPEAT_COUNT))); if (trigger.get(REPEAT_INTERVAL) != null && !trigger.get(REPEAT_INTERVAL).isEmpty()) simpleTrigger.setRepeatInterval(Long.parseLong(trigger.get(REPEAT_INTERVAL))); if (trigger.get(TIMES_TRIGGERED) != null && !trigger.get(TIMES_TRIGGERED).isEmpty()) simpleTrigger.setTimesTriggered(Integer.parseInt(trigger.get(TIMES_TRIGGERED))); return simpleTrigger; } else if (TRIGGER_TYPE_CRON.equals(trigger.get(TRIGGER_TYPE))) { CronTriggerImpl cronTrigger = new CronTriggerImpl(); setOperableTriggerFields(triggerKey, trigger, cronTrigger); if (trigger.get(TIME_ZONE_ID) != null && !trigger.get(TIME_ZONE_ID).isEmpty()) cronTrigger.getTimeZone().setID(trigger.get(TIME_ZONE_ID).isEmpty() ? null : trigger.get(TIME_ZONE_ID)); try { if (trigger.get(CRON_EXPRESSION) != null && !trigger.get(CRON_EXPRESSION).isEmpty()) cronTrigger.setCronExpression(trigger.get(CRON_EXPRESSION).isEmpty() ? null : trigger.get(CRON_EXPRESSION)); } catch (ParseException ex) { log.warn("could not parse cron_expression: " + trigger.get(CRON_EXPRESSION) + " for trigger: " + createTriggerHashKey(triggerKey.getGroup(), triggerKey.getName())); } return cronTrigger; } else { // other trigger types are not supported throw new UnsupportedOperationException(); } }
tz.setRawOffset(restrainTZoffset(hrSign * (tzHours * MILLIS_PER_HOUR + tzMin * (long) MILLIS_PER_MINUTE))); tz.setID("unknown");