本文整理了Java中java.util.TimeZone.setID()
方法的一些代码示例,展示了TimeZone.setID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeZone.setID()
方法的具体详情如下:
包路径:java.util.TimeZone
类名称:TimeZone
方法名:setID
[英]Sets the time zone ID. This does not change any other data in the time zone object.
[中]设置时区ID。这不会更改时区对象中的任何其他数据。
代码示例来源:origin: apache/pdfbox
if (offset == 0)
tz.setID("GMT");
tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
tz.setID("unknown");
代码示例来源:origin: apache/pdfbox
if (offset == 0)
tz.setID("GMT");
tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
tz.setID("unknown");
代码示例来源:origin: dlew/joda-time-android
tz.setID("GMT-\u0660\u0668:\u0660\u0660");
zone = DateTimeZone.forTimeZone(tz);
assertEquals("-08:00", zone.getID());
代码示例来源:origin: at.bestsolution.eclipse/com.ibm.icu.base
/**
* 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);
}
代码示例来源:origin: org.jboss.seam/jboss-seam
@Override
public void setID(String id) {
super.setID(id);
timeZone = TimeZone.getTimeZone(id);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base
/**
* 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);
}
代码示例来源:origin: org.apache.pdfbox/pdfbox
if (offset == 0)
tz.setID("GMT");
tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
tz.setID("unknown");
代码示例来源:origin: com.github.lafa.pdfbox/xmpbox
if (offset == 0)
tz.setID("GMT");
tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
tz.setID("unknown");
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
if (offset == 0)
tz.setID("GMT");
tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
tz.setID("unknown");
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* TimeZone API; calls through to wrapped time zone.
*/
@Override
public void setID(String ID) {
super.setID(ID);
zone.setID(ID);
}
代码示例来源:origin: org.apache.pdfbox/xmpbox
if (offset == 0)
tz.setID("GMT");
tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
tz.setID("unknown");
代码示例来源:origin: org.apache.pdfbox/jempbox
if (offset == 0)
tz.setID("GMT");
tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
tz.setID("unknown");
代码示例来源:origin: stackoverflow.com
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)));
代码示例来源:origin: com.ibm.icu/icu4j-localespi
@Override
public void setID(String ID) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify a frozen TimeZoneJDK instance.");
}
fJdkTz.setID(ID);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Constructs an adapter for a com.ibm.icu.util.TimeZone object.
*/
public TimeZoneAdapter(TimeZone zone) {
this.zone = zone;
super.setID(zone.getID());
}
代码示例来源:origin: stackoverflow.com
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");
}
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* 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;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.oracle
/**
* 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;
}
代码示例来源:origin: RedisLabs/redis-quartz
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();
}
}
代码示例来源:origin: TomRoush/PdfBox-Android
tz.setRawOffset(restrainTZoffset(hrSign * (tzHours * MILLIS_PER_HOUR + tzMin *
(long) MILLIS_PER_MINUTE)));
tz.setID("unknown");
内容来源于网络,如有侵权,请联系作者删除!