Home  >  Article  >  Java  >  How to use LocalTime in Java?

How to use LocalTime in Java?

PHPz
PHPzforward
2023-05-09 08:28:061064browse

Explanation

1. LocalTime represents a time class that does not specify a time area.

2. LocalTime provides a variety of static factory methods to simplify the creation and operation of time object examples, including the operation of analyzing time strings.

Example

LocalTime late = LocalTime.of(23, 59, 59);
System.out.println(late);       // 23:59:59
 
DateTimeFormatter germanFormatter =
    DateTimeFormatter
        .ofLocalizedTime(FormatStyle.SHORT)
        .withLocale(Locale.GERMAN);
 
LocalTime leetTime = LocalTime.parse("13:37", germanFormatter);
System.out.println(leetTime);   // 13:37

What are the basic data types of java

The basic data types of Java are divided into:

1. Integer type , a data type used to represent integers.

2. Floating point type, a data type used to represent decimals.

3. Character type. The keyword of character type is "char".

4. Boolean type is the basic data type that represents logical values.

The above is the detailed content of How to use LocalTime in Java?. 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