LocalDate atTime(int hour, int minute, int second, int nanoOfSecond) example

Description

LocalDate atTime(int hour, int minute, int second, int nanoOfSecond) combines this date with a time to create a LocalDateTime.

Syntax

atTime has the following syntax.


public LocalDateTime atTime(int hour,   int minute,   int second,   int nanoOfSecond)

Example

The following example shows how to use atTime.


import java.time.LocalDate;
import java.time.LocalDateTime;
/* w  ww  .  j  av  a 2  s .  c o  m*/
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);

    LocalDateTime l = a.atTime(2,3,4, 5);    
    System.out.println(l); 
  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset