Class TimeFormatKit
java.lang.Object
com.iohao.net.common.kit.time.TimeFormatKit
Date/time formatting utilities with cached
DateTimeFormatter instances.- Since:
- 21.16
- Author:
- 渔民小镇
- date:
- 2024-08-27
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringformat()Format the current date/time asyyyy-MM-dd HH:mm:ss.static Stringformat(long timeMillis) Format the given epoch milliseconds asyyyy-MM-dd HH:mm:ss.static Stringformat(TemporalAccessor temporal) Format the given temporal asyyyy-MM-dd HH:mm:ss.static Stringformat(TemporalAccessor temporal, String pattern) Format the given temporal using the specified pattern.static DateTimeFormatterget singleton DateTimeFormatter by pattern
-
Method Details
-
ofPattern
get singleton DateTimeFormatter by pattern- Parameters:
pattern- the pattern to use, not null- Returns:
- the formatter based on the pattern, not null
-
format
Format the current date/time asyyyy-MM-dd HH:mm:ss.- Returns:
- the formatted current date/time string
-
format
Format the given epoch milliseconds asyyyy-MM-dd HH:mm:ss.- Parameters:
timeMillis- the epoch milliseconds to format- Returns:
- the formatted date/time string
-
format
Format the given temporal asyyyy-MM-dd HH:mm:ss.- Parameters:
temporal- the temporal to format- Returns:
- the formatted date/time string
-
format
Format the given temporal using the specified pattern.- Parameters:
temporal- the temporal to formatpattern- the date/time pattern to use- Returns:
- the formatted date/time string
-