Java Date Time Java Java API
java.time.OffsetTime
public OffsetDateTime atDate(LocalDate date)
Combines this OffsetTime with the provided LocalDate and returns a new OffsetDateTime.
package com.logicbig.example.offsettime;import java.time.LocalDate;import java.time.OffsetDateTime;import java.time.OffsetTime;import java.time.ZoneOffset;public class AtDateExample { public static void main(String... args) { OffsetTime t = OffsetTime.of(17, 40, 33, 20000, ZoneOffset.ofHours(-6)); System.out.println(t); LocalDate d = LocalDate.of(2015, 11, 2); System.out.println(d); OffsetDateTime offsetDateTime = t.atDate(d); System.out.println(offsetDateTime); }}
17:40:33.000020-06:002015-11-022015-11-02T17:40:33.000020-06:00
package com.logicbig.example.offsettime;import java.time.*;public class AtDateExample2 { public static void main(String... args) { OffsetTime t = OffsetTime.of(LocalTime.NOON, ZoneOffset.of("-06:00")); System.out.println(t); LocalDate d = LocalDate.now(); System.out.println(d); OffsetDateTime offsetDateTime = t.atDate(d); System.out.println(offsetDateTime); }}
12:00-06:002025-10-292025-10-29T12:00-06:00