本文整理了Java中net.time4j.ZonalDateTime.toMoment()
方法的一些代码示例,展示了ZonalDateTime.toMoment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonalDateTime.toMoment()
方法的具体详情如下:
包路径:net.time4j.ZonalDateTime
类名称:ZonalDateTime
方法名:toMoment
[英]Converts this object to a global UTC-moment.
[中]将此对象转换为全局UTC时刻。
代码示例来源:origin: net.time4j/time4j-core
@Override
public ZonedDateTime from(ZonalDateTime zdt) {
Instant instant = TemporalType.INSTANT.from(zdt.toMoment());
ZoneId zone;
try {
zone = ZoneId.of(zdt.getTimezone().canonical());
} catch (DateTimeException ex) {
ZonalOffset zo = Timezone.of(zdt.getTimezone()).getOffset(zdt.toMoment());
zone = ZoneOffset.of(zo.toString());
}
return ZonedDateTime.ofInstant(instant, zone);
}
代码示例来源:origin: net.time4j/time4j-core
@Override
public Calendar from(ZonalDateTime time4j) {
Date jud = TemporalType.JAVA_UTIL_DATE.from(time4j.toMoment());
TimeZone tz = TemporalType.JAVA_UTIL_TIMEZONE.from(time4j.getTimezone0());
GregorianCalendar gcal = new GregorianCalendar();
gcal.setGregorianChange(new Date(Long.MIN_VALUE)); // proleptic gregorian
gcal.setFirstDayOfWeek(Calendar.MONDAY); // keeping ISO-8601-semantic
gcal.setMinimalDaysInFirstWeek(4); // keeping ISO-8601-semantic
gcal.setTimeZone(tz);
gcal.setTime(jud);
return gcal;
}
代码示例来源:origin: net.time4j/time4j-core
} else if (this.type.equals(ZonalDateTime.class)) {
ZonalDateTime zdt = ZonalDateTime.class.cast(formattable);
Moment moment = zdt.toMoment();
Date jud = TemporalType.JAVA_UTIL_DATE.from(moment);
String timezone = (
代码示例来源:origin: net.time4j/time4j-core
ZonalDateTime.class, realPattern, this.locale, this.leniency, this.tzid);
ZonalDateTime zdt = stf.parseInternal(text, position, wantsException, rawValues);
result = ((zdt == null) ? null : zdt.toMoment());
} else if (this.type.equals(ZonalDateTime.class)) {
String timezone = (
代码示例来源:origin: net.time4j/time4j-range
ZonalDateTime zdt = ZonalDateTime.parse(parts[1], momentFormatter(extended));
Duration<?> duration = Duration.parsePeriod(parts[2]);
recurrence = IsoRecurrence.of(count, zdt.toMoment(), duration, zdt.getOffset());
} else if (parts[1].charAt(0) == 'P') {
Duration<?> duration = Duration.parsePeriod(parts[1]);
boolean extended = isExtendedFormat(parts[2]);
ZonalDateTime zdt = ZonalDateTime.parse(parts[2], momentFormatter(extended));
recurrence = IsoRecurrence.of(count, duration, zdt.toMoment(), zdt.getOffset());
} else {
String remainder = iso.substring(getFirstSlash(iso) + 1);
内容来源于网络,如有侵权,请联系作者删除!