Java Code Examples for java.time.LocalDateTime#atOffset()
The following examples show how to use
java.time.LocalDateTime#atOffset() .
These examples are extracted from open source projects.
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 Project: PgBulkInsert File: TimeStampUtils.java License: MIT License | 5 votes |
private static long getSecondsSinceJavaEpoch(LocalDateTime localDateTime) { // Adjust TimeZone Offset: OffsetDateTime zdt = localDateTime.atOffset(ZoneOffset.UTC); // Get the Epoch Milliseconds: long milliseconds = zdt.toInstant().toEpochMilli(); // Turn into Seconds: return TimeUnit.MILLISECONDS.toSeconds(milliseconds); }
Example 2
Source Project: r2dbc-mysql File: TimeZoneIntegrationTestSupport.java License: Apache License 2.0 | 4 votes |
private static OffsetDateTime toOffsetDateTime(LocalDateTime value) { return value.atOffset(ZoneId.systemDefault().getRules().getOffset(value)); }
Example 3
Source Project: dragonwell8_jdk File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 4
Source Project: TencentKona-8 File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 5
Source Project: jdk8u60 File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 6
Source Project: r2dbc-mysql File: TimeZoneIntegrationTestSupport.java License: Apache License 2.0 | 4 votes |
private static OffsetDateTime toOffsetDateTime(LocalDateTime value) { return value.atOffset(ZoneId.systemDefault().getRules().getOffset(value)); }
Example 7
Source Project: openjdk-jdk8u File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 8
Source Project: openjdk-jdk8u-backup File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 9
Source Project: openjdk-jdk9 File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 10
Source Project: jdk8u-jdk File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 11
Source Project: hottub File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 12
Source Project: openjdk-8-source File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 13
Source Project: FlinkExperiments File: DateUtilities.java License: MIT License | 4 votes |
public static Date from(LocalDateTime localDateTime, ZoneOffset zoneOffset) { OffsetDateTime offsetDateTime = localDateTime.atOffset(zoneOffset); return Date.from(offsetDateTime.toInstant()); }
Example 14
Source Project: openjdk-8 File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 15
Source Project: jdk8u_jdk File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 16
Source Project: JavaElasticSearchExperiment File: DateUtilities.java License: MIT License | 4 votes |
public static Date from(LocalDateTime localDateTime, ZoneOffset zoneOffset) { OffsetDateTime zdt = localDateTime.atOffset(zoneOffset); return Date.from(zdt.toInstant()); }
Example 17
Source Project: jdk8u-jdk File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 18
Source Project: jdk8u-dev-jdk File: TCKLocalDateTime.java License: GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 19
Source Project: j2objc File: TCKLocalDateTime.java License: Apache License 2.0 | 4 votes |
@Test(expected=NullPointerException.class) public void test_atOffset_nullZoneOffset() { LocalDateTime t = LocalDateTime.of(2008, 6, 30, 11, 30); t.atOffset((ZoneOffset) null); }
Example 20
Source Project: shimmer File: RunkeeperDataPointMapper.java License: Apache License 2.0 | 2 votes |
private TimeFrame asTimeFrame(LocalDateTime localStartDateTime, int utcOffsetInHours, Double durationInSeconds) { OffsetDateTime startDateTime = localStartDateTime.atOffset(ZoneOffset.ofHours(utcOffsetInHours)); return new TimeFrame(ofStartDateTimeAndDuration(startDateTime, SECOND.newUnitValue(durationInSeconds))); }