Java Code Examples for org.threeten.bp.ZonedDateTime#ofInstant()
The following examples show how to use
org.threeten.bp.ZonedDateTime#ofInstant() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestStandardZoneRules.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void test_London_previousTransition_rulesBased() { ZoneRules test = europeLondon(); List<ZoneOffsetTransitionRule> rules = test.getTransitionRules(); List<ZoneOffsetTransition> trans = test.getTransitions(); ZoneOffsetTransition last = trans.get(trans.size() - 1); assertEquals(test.previousTransition(last.getInstant().plusSeconds(1)), last); assertEquals(test.previousTransition(last.getInstant().plusNanos(1)), last); // Jan 1st of year between transitions and rules ZonedDateTime odt = ZonedDateTime.ofInstant(last.getInstant(), last.getOffsetAfter()); odt = odt.withDayOfYear(1).plusYears(1).with(LocalTime.MIDNIGHT); assertEquals(test.previousTransition(odt.toInstant()), last); // later years for (int year = 1998; year < 2010; year++) { ZoneOffsetTransition a = rules.get(0).createTransition(year); ZoneOffsetTransition b = rules.get(1).createTransition(year); ZoneOffsetTransition c = rules.get(0).createTransition(year + 1); assertEquals(test.previousTransition(c.getInstant()), b); assertEquals(test.previousTransition(b.getInstant().plusSeconds(1)), b); assertEquals(test.previousTransition(b.getInstant().plusNanos(1)), b); assertEquals(test.previousTransition(b.getInstant()), a); assertEquals(test.previousTransition(a.getInstant().plusSeconds(1)), a); assertEquals(test.previousTransition(a.getInstant().plusNanos(1)), a); } }
Example 2
Source File: CustomInstantDeserializer.java From tutorials with MIT License | 4 votes |
@Override public ZonedDateTime apply(FromIntegerArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); }
Example 3
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromIntegerArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); }
Example 4
Source File: Examples.java From ThreeTenABP with Apache License 2.0 | 4 votes |
public ZonedDateTime hereAndNow() { return ZonedDateTime.ofInstant(now(), ZoneId.systemDefault()); }
Example 5
Source File: CustomInstantDeserializer.java From tutorials with MIT License | 4 votes |
@Override public ZonedDateTime apply(FromDecimalArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); }
Example 6
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromIntegerArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); }
Example 7
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromDecimalArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); }
Example 8
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromDecimalArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); }
Example 9
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromIntegerArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); }
Example 10
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromDecimalArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); }
Example 11
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromDecimalArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); }
Example 12
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromIntegerArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); }
Example 13
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromDecimalArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); }
Example 14
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromIntegerArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); }
Example 15
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromDecimalArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); }
Example 16
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromIntegerArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); }
Example 17
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromDecimalArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); }
Example 18
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromIntegerArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); }
Example 19
Source File: CustomInstantDeserializer.java From openapi-generator with Apache License 2.0 | 4 votes |
@Override public ZonedDateTime apply(FromDecimalArguments a) { return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); }
Example 20
Source File: IsoChronology.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Obtains an ISO zoned date-time from an instant. * <p> * This is equivalent to {@link ZonedDateTime#ofInstant(Instant, ZoneId)}. * * @param instant the instant to convert, not null * @param zone the zone to use, not null * @return the ISO zoned date-time, not null * @throws DateTimeException if unable to create the date-time */ @Override // override with covariant return type public ZonedDateTime zonedDateTime(Instant instant, ZoneId zone) { return ZonedDateTime.ofInstant(instant, zone); }