本文整理了Java中org.threeten.bp.OffsetDateTime.ofInstant()
方法的一些代码示例,展示了OffsetDateTime.ofInstant()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OffsetDateTime.ofInstant()
方法的具体详情如下:
包路径:org.threeten.bp.OffsetDateTime
类名称:OffsetDateTime
方法名:ofInstant
[英]Obtains an instance of OffsetDateTime from an Instant and zone ID.
This creates an offset date-time with the same instant as that specified. Finding the offset from UTC/Greenwich is simple as there is only one valid offset for each instant.
[中]
代码示例来源:origin: ThreeTen/threetenbp
/**
* Combines this instant with an offset to create an {@code OffsetDateTime}.
* <p>
* This returns an {@code OffsetDateTime} formed from this instant at the
* specified offset from UTC/Greenwich. An exception will be thrown if the
* instant is too large to fit into an offset date-time.
* <p>
* This method is equivalent to
* {@link OffsetDateTime#ofInstant(Instant, ZoneId) OffsetDateTime.ofInstant(this, offset)}.
*
* @param offset the offset to combine with, not null
* @return the offset date-time formed from this instant and the specified offset, not null
* @throws DateTimeException if the result exceeds the supported range
*/
public OffsetDateTime atOffset(ZoneOffset offset) {
return OffsetDateTime.ofInstant(this, offset);
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Combines this instant with an offset to create an {@code OffsetDateTime}.
* <p>
* This returns an {@code OffsetDateTime} formed from this instant at the
* specified offset from UTC/Greenwich. An exception will be thrown if the
* instant is too large to fit into an offset date-time.
* <p>
* This method is equivalent to
* {@link OffsetDateTime#ofInstant(Instant, ZoneId) OffsetDateTime.ofInstant(this, offset)}.
*
* @param offset the offset to combine with, not null
* @return the offset date-time formed from this instant and the specified offset, not null
* @throws DateTimeException if the result exceeds the supported range
*/
public OffsetDateTime atOffset(ZoneOffset offset) {
return OffsetDateTime.ofInstant(this, offset);
}
代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp
@Override
public OffsetDateTime apply(FromIntegerArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
}
},
代码示例来源:origin: XeroAPI/Xero-Java
@Override
public OffsetDateTime apply(FromIntegerArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
}
},
代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp
@Override
public OffsetDateTime apply(FromDecimalArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
}
},
代码示例来源:origin: gengstrand/clojure-news-feed
@Override
public OffsetDateTime apply(FromIntegerArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
}
},
代码示例来源:origin: gengstrand/clojure-news-feed
@Override
public OffsetDateTime apply(FromDecimalArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
}
},
代码示例来源:origin: mercadolibre/java-sdk
@Override
public OffsetDateTime apply(FromIntegerArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
}
},
代码示例来源:origin: mercadolibre/java-sdk
@Override
public OffsetDateTime apply(FromDecimalArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
}
},
代码示例来源:origin: XeroAPI/Xero-Java
@Override
public OffsetDateTime apply(FromDecimalArguments a) {
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
}
},
代码示例来源:origin: ThreeTen/threetenbp
} catch (DateTimeException ignore) {
Instant instant = Instant.from(temporal);
return OffsetDateTime.ofInstant(instant, offset);
代码示例来源:origin: org.threeten/threetenbp
} catch (DateTimeException ignore) {
Instant instant = Instant.from(temporal);
return OffsetDateTime.ofInstant(instant, offset);
代码示例来源:origin: ThreeTen/threetenbp
/**
* Obtains the current date-time from the specified clock.
* <p>
* This will query the specified clock to obtain the current date-time.
* The offset will be calculated from the time-zone in the clock.
* <p>
* Using this method allows the use of an alternate clock for testing.
* The alternate clock may be introduced using {@link Clock dependency injection}.
*
* @param clock the clock to use, not null
* @return the current date-time, not null
*/
public static OffsetDateTime now(Clock clock) {
Jdk8Methods.requireNonNull(clock, "clock");
final Instant now = clock.instant(); // called once
return ofInstant(now, clock.getZone().getRules().getOffset(now));
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Obtains the current date-time from the specified clock.
* <p>
* This will query the specified clock to obtain the current date-time.
* The offset will be calculated from the time-zone in the clock.
* <p>
* Using this method allows the use of an alternate clock for testing.
* The alternate clock may be introduced using {@link Clock dependency injection}.
*
* @param clock the clock to use, not null
* @return the current date-time, not null
*/
public static OffsetDateTime now(Clock clock) {
Jdk8Methods.requireNonNull(clock, "clock");
final Instant now = clock.instant(); // called once
return ofInstant(now, clock.getZone().getRules().getOffset(now));
}
代码示例来源:origin: ThreeTen/threetenbp
return with(dateTime.with(adjuster), offset);
} else if (adjuster instanceof Instant) {
return ofInstant((Instant) adjuster, offset);
} else if (adjuster instanceof ZoneOffset) {
return with(dateTime, (ZoneOffset) adjuster);
代码示例来源:origin: org.threeten/threetenbp
return with(dateTime.with(adjuster), offset);
} else if (adjuster instanceof Instant) {
return ofInstant((Instant) adjuster, offset);
} else if (adjuster instanceof ZoneOffset) {
return with(dateTime, (ZoneOffset) adjuster);
代码示例来源:origin: ThreeTen/threetenbp
ChronoField f = (ChronoField) field;
switch (f) {
case INSTANT_SECONDS: return ofInstant(Instant.ofEpochSecond(newValue, getNano()), offset);
case OFFSET_SECONDS: {
return with(dateTime, ZoneOffset.ofTotalSeconds(f.checkValidIntValue(newValue)));
代码示例来源:origin: org.threeten/threetenbp
ChronoField f = (ChronoField) field;
switch (f) {
case INSTANT_SECONDS: return ofInstant(Instant.ofEpochSecond(newValue, getNano()), offset);
case OFFSET_SECONDS: {
return with(dateTime, ZoneOffset.ofTotalSeconds(f.checkValidIntValue(newValue)));
内容来源于网络,如有侵权,请联系作者删除!