Answers for "java localtime example"

1

localdatetime java example

LocalDateTime current=LocalDateTime.now();//gets current LocalDateTime
LocalDateTime dateTime=LocalDateTime.of(year,month,day,hour,minute,second);//gets specific LocalDateTime
dateTime.getHour();//get the hour of a DateTime
dateTime.getDayOfWeek();//get number of current day in week
dateTime.isBefore(someOtherDateTime);//checks if it is before another LocalDateTime
dateTime.toLocalDate();//converts it to a LocalDate
dateTime.toLocalTime();//converts it to a LocalTime
Posted by: Guest on April-06-2021
1

java localtime

import java.time.LocalTime;  
public class LocalTimeExample1 {  
  public static void main(String[] args) {  
    LocalTime time = LocalTime.now();  
    System.out.println(time);  
  }  
}
Posted by: Guest on June-20-2021
0

localtime java

import java.time.LocalTime;  
public class LocalTimeExample4 {  
  public static void main(String[] args) {  
    LocalTime time1 = LocalTime.of(10,43,12);  
    System.out.println(time1);  
    LocalTime time2=time1.plusHours(4);  
    LocalTime time3=time2.plusMinutes(18);  
    System.out.println(time3);  
  }  
}
Posted by: Guest on July-09-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language