Home  >  Article  >  Java  >  How to get the current time in Java8

How to get the current time in Java8

王林
王林forward
2023-05-02 10:22:061251browse

Getting the current time in Java 8

package com.shxt.demo02;  
import java.time.LocalTime;  
public class Demo06 {      
public static void main(String[] args) {          
LocalTime time = LocalTime.now();          
System.out.println("获取当前的时间,不含有日期:"+time);      
}  
}

You can see that the current time only contains time information and no date

The above is the detailed content of How to get the current time in Java8. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete