- java.time Package Classes
- java.time - Home
- java.time - Clock
- java.time - Duration
- java.time - Instant
- java.time - LocalDate
- java.time - LocalDateTime
- java.time - LocalTime
- java.time - MonthDay
- java.time - OffsetDateTime
- java.time - OffsetTime
- java.time - Period
- java.time - Year
- java.time - YearMonth
- java.time - ZonedDateTime
- java.time - ZoneId
- java.time - ZoneOffset
- java.time Package Enums
- java.time - Month
- java.time Useful Resources
- java.time - Discussion
java.time.LocalTime.atDate() Method Example
Description
The java.time.LocalTime.atDate(LocalDate date) method combines this time with a date to create a LocalDateTime.
Declaration
Following is the declaration for java.time.LocalTime.atDate(LocalDate date) method.
public LocalDateTime atDate(LocalDate date)
Parameters
date − the date to combine with, not null.
Return Value
the local date-time formed from this time and the specified date, not null.
Example
The following example shows the usage of java.time.LocalTime.atDate(LocalDate date) method.
package com.tutorialspoint; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; public class LocalTimeDemo { public static void main(String[] args) { LocalDate date = LocalDate.now(); System.out.println(date); LocalTime time = LocalTime.parse("12:30:30"); LocalDateTime datetime = time.atDate(date); System.out.println(datetime); } }
Let us compile and run the above program, this will produce the following result −
2017-03-20 2017-03-20T12:30:30
Advertisements
To Continue Learning Please Login
Login with Google