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

How to get the current time in Java8

王林
Release: 2023-05-02 10:22:06
forward
1280 people have browsed it

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);      
}  
}
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template