本文整理了Java中org.threeten.bp.ZoneOffset.of()
方法的一些代码示例,展示了ZoneOffset.of()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneOffset.of()
方法的具体详情如下:
包路径:org.threeten.bp.ZoneOffset
类名称:ZoneOffset
方法名:of
[英]Obtains an instance of ZoneOffset using the ID.
This method parses the string ID of a ZoneOffset to return an instance. The parsing accepts all the formats generated by #getId(), plus some additional formats:
Note that ± means either the plus or minus symbol.
The ID of the returned offset will be normalized to one of the formats described by #getId().
The maximum supported range is from +18:00 to -18:00 inclusive.
[中]使用ID获取ZoneOffset的实例。
此方法解析ZoneOffset的字符串ID以返回实例。解析接受#getId()生成的所有格式,以及一些其他格式:
*Z-代表UTC
*+h
*+hh
*+hh:mm
*-hh:mm
*+hhmm
*-hhmm
*+hh:mm:ss
*-hh:mm:ss
*+hhmms
*-hhmms
请注意,±表示加号或减号。
返回的偏移量的ID将标准化为#getId()描述的格式之一。
支持的最大范围为+18:00到-18:00(含18:00)。
代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp
@Override
protected ZoneOffset deserialize(String key, DeserializationContext ctxt) throws IOException {
try {
return ZoneOffset.of(key);
} catch (DateTimeException e) {
return _rethrowDateTimeException(ctxt, ZoneOffset.class, e, key);
}
}
}
代码示例来源:origin: ThreeTen/threetenbp
ZoneOffset offset = ZoneOffset.of(zoneId.substring(3));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion(zoneId.substring(0, 3), offset.getRules());
ZoneOffset offset = ZoneOffset.of(zoneId.substring(2));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion("UT", offset.getRules());
代码示例来源:origin: org.threeten/threetenbp
ZoneOffset offset = ZoneOffset.of(zoneId.substring(3));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion(zoneId.substring(0, 3), offset.getRules());
ZoneOffset offset = ZoneOffset.of(zoneId.substring(2));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion("UT", offset.getRules());
代码示例来源:origin: org.threeten/threetenbp
return ZoneOffset.of(zoneId);
ZoneOffset offset = ZoneOffset.of(zoneId.substring(3));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion(zoneId.substring(0, 3), offset.getRules());
ZoneOffset offset = ZoneOffset.of(zoneId.substring(2));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion("UT", offset.getRules());
代码示例来源:origin: ThreeTen/threetenbp
return ZoneOffset.of(zoneId);
ZoneOffset offset = ZoneOffset.of(zoneId.substring(3));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion(zoneId.substring(0, 3), offset.getRules());
ZoneOffset offset = ZoneOffset.of(zoneId.substring(2));
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion("UT", offset.getRules());
代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp
@Override
public Object deserialize(JsonParser parser, DeserializationContext context) throws IOException
{
if (parser.hasToken(JsonToken.VALUE_STRING)) {
String string = parser.getText().trim();
if (string.length() == 0) {
return null;
}
try {
switch (_valueType) {
case TYPE_PERIOD:
return Period.parse(string);
case TYPE_ZONE_ID:
return ZoneId.of(string);
case TYPE_ZONE_OFFSET:
return ZoneOffset.of(string);
}
} catch (DateTimeException e) {
_rethrowDateTimeException(parser, context, e, string);
}
}
if (parser.hasToken(JsonToken.VALUE_EMBEDDED_OBJECT)) {
// 20-Apr-2016, tatu: Related to [databind#1208], can try supporting embedded
// values quite easily
return parser.getEmbeddedObject();
}
throw context.wrongTokenException(parser, JsonToken.VALUE_STRING, null);
}
内容来源于网络,如有侵权,请联系作者删除!