本文整理了Java中java.time.ZoneOffset.normalized()
方法的一些代码示例,展示了ZoneOffset.normalized()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneOffset.normalized()
方法的具体详情如下:
包路径:java.time.ZoneOffset
类名称:ZoneOffset
方法名:normalized
暂无
代码示例来源:origin: FINRAOS/DataGenerator
@Override
public LocalDateTime next(TransformationContext context) {
if(direction.equals(Direction.ASCENDING)) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(current.getAndAdd(step.toMillis())), this.offset.normalized());
} else {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(current.getAndAdd(step.toMillis() * -1)), this.offset.normalized());
}
}
}
代码示例来源:origin: org.cactoos/cactoos
/**
* Parses date using the provided format to create
* {@link OffsetDateTime} instances.
* @param date The date to parse.
* @param format The format to use.
* @param offset The offset to use.
*/
public OffsetDateTimeOf(final CharSequence date, final String format,
final ZoneOffset offset) {
this(date,
DateTimeFormatter.ofPattern(format).withZone(offset.normalized())
);
}
代码示例来源:origin: yegor256/cactoos
/**
* Parses date using the provided format to create
* {@link OffsetDateTime} instances.
* @param date The date to parse.
* @param format The format to use.
* @param offset The offset to use.
*/
public OffsetDateTimeOf(final CharSequence date, final String format,
final ZoneOffset offset) {
this(date,
DateTimeFormatter.ofPattern(format).withZone(offset.normalized())
);
}
代码示例来源:origin: exoplatform/platform
@Override
public LocalDateTime getLastCheckedTime(IDMEntityType<?> entityType) {
if (entityType == null) {
throw new IllegalArgumentException("entityType is null");
}
SettingValue<?> settingValue = settingService.get(Context.GLOBAL,
IDM_SCOPE,
"DATE-" + entityType.getClassType().getSimpleName());
if (settingValue == null) {
return null;
} else {
Object value = settingValue.getValue();
long timestamp;
if (value instanceof Long) {
timestamp = (Long) value;
} else if (value instanceof String) {
timestamp = Long.parseLong(String.valueOf(value));
} else {
LOG.warn("value of type" + value.getClass().getSimpleName() + " is not recognized");
return null;
}
LocalDateTime dateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneOffset.UTC.normalized());
return dateTime;
}
}
内容来源于网络,如有侵权,请联系作者删除!