Java Code Examples for java.time.OffsetDateTime#toInstant()
The following examples show how to use
java.time.OffsetDateTime#toInstant() .
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: OffsetDateTimeConverter.java From requery with Apache License 2.0 | 5 votes |
@Override public Timestamp convertToPersisted(OffsetDateTime value) { if (value == null) { return null; } Instant instant = value.toInstant(); return Timestamp.from(instant); }
Example 2
Source File: TestOffsetDateTime_instants.java From j2objc with Apache License 2.0 | 5 votes |
@Test public void test_toInstant_19700101_minusOneNano() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(23, 59, 59, 999999999), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -1); assertEquals(test.getNano(), 999999999); }
Example 3
Source File: TestOffsetDateTime_instants.java From j2objc with Apache License 2.0 | 5 votes |
@Test public void test_toInstant_19691231() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -24L * 60L * 60L); assertEquals(test.getNano(), 0); }
Example 4
Source File: TestOffsetDateTime_instants.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700101_oneNano() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1970, 1, 1), LocalTime.of(0, 0, 0, 1), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), 0); assertEquals(test.getNano(), 1); }
Example 5
Source File: TestOffsetDateTime_instants.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19691231() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -24L * 60L * 60L); assertEquals(test.getNano(), 0); }
Example 6
Source File: TestOffsetDateTime_instants.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19691231() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -24L * 60L * 60L); assertEquals(test.getNano(), 0); }
Example 7
Source File: DateTimeConverters.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public Instant convert(OffsetDateTime source) { return source.toInstant(); }
Example 8
Source File: TestOffsetDateTime_instants.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19691231() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -24L * 60L * 60L); assertEquals(test.getNano(), 0); }
Example 9
Source File: TestOffsetDateTime_instants.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700102() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1970, 1, 2), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), 24L * 60L * 60L); assertEquals(test.getNano(), 0); }
Example 10
Source File: TestOffsetDateTime_instants.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700101_minusOneNano() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(23, 59, 59, 999999999), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -1); assertEquals(test.getNano(), 999999999); }
Example 11
Source File: Customer.java From specification-arg-resolver with Apache License 2.0 | 4 votes |
public void setDateOfNextSpecialOffer(OffsetDateTime dateOfNextSpecialOffer) { this.dateOfNextSpecialOffer = dateOfNextSpecialOffer; this.dateOfNextSpecialOfferInstant = dateOfNextSpecialOffer.toInstant(); }
Example 12
Source File: TestOffsetDateTime_instants.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700101() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1970, 1, 1), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), 0); assertEquals(test.getNano(), 0); }
Example 13
Source File: TestOffsetDateTime_instants.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700101() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1970, 1, 1), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), 0); assertEquals(test.getNano(), 0); }
Example 14
Source File: TestOffsetDateTime_instants.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19691231() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -24L * 60L * 60L); assertEquals(test.getNano(), 0); }
Example 15
Source File: TestOffsetDateTime_instants.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700101_minusOneNano() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(23, 59, 59, 999999999), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -1); assertEquals(test.getNano(), 999999999); }
Example 16
Source File: TestOffsetDateTime_instants.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700101() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1970, 1, 1), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), 0); assertEquals(test.getNano(), 0); }
Example 17
Source File: TestOffsetDateTime_instants.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19691231() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -24L * 60L * 60L); assertEquals(test.getNano(), 0); }
Example 18
Source File: TestOffsetDateTime_instants.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700101() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1970, 1, 1), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), 0); assertEquals(test.getNano(), 0); }
Example 19
Source File: TestOffsetDateTime_instants.java From hottub with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700102() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1970, 1, 2), LocalTime.of(0, 0, 0, 0), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), 24L * 60L * 60L); assertEquals(test.getNano(), 0); }
Example 20
Source File: TestOffsetDateTime_instants.java From hottub with GNU General Public License v2.0 | 4 votes |
public void test_toInstant_19700101_minusOneNano() { OffsetDateTime dt = OffsetDateTime.of(LocalDate.of(1969, 12, 31), LocalTime.of(23, 59, 59, 999999999), ZoneOffset.UTC); Instant test = dt.toInstant(); assertEquals(test.getEpochSecond(), -1); assertEquals(test.getNano(), 999999999); }