public class DateUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static java.time.format.DateTimeFormatter |
DATE_FORMAT |
static java.time.format.DateTimeFormatter |
DATE_FORMAT_EST |
static java.time.format.DateTimeFormatter |
DATE_FORMAT_NY |
static java.time.format.DateTimeFormatter |
DATETIME_FORMAT |
| 构造器和说明 |
|---|
DateUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Long |
getTimestamp(String time,
TimeZoneId zoneId) |
static Date |
getZoneDate(String time,
TimeZoneId zoneId) |
static boolean |
isDateBeforeToday(String date)
Is the date before today
|
static boolean |
isDateBeforeToday(String date,
TimeZoneId zoneId)
Is the date before today
|
static long |
parseEpochMill(java.time.LocalDate localDate) |
static long |
parseEpochMill(java.time.LocalDate localDate,
TimeZoneId zoneId) |
static long |
parseEpochMill(String date,
TimeZoneId zoneId)
parse date
|
static String |
printDate(long timestamp,
TimeZoneId timeZoneId)
Convert to yyyy-MM-dd
|
static String |
printDateTime(long timestamp,
java.time.format.DateTimeFormatter formatter,
TimeZoneId timeZoneId)
Convert to yyyy-MM- or "yyyy-MM-dd HH:mm:ss"
|
static String |
printSystemDate()
get system date(yyyy-MM-dd)
|
static String |
printSystemDate(TimeZoneId timeZoneId) |
static String |
printTimeZoneET(long timestamp)
Convert to Eastern Time
|
public static final java.time.format.DateTimeFormatter DATE_FORMAT
public static final java.time.format.DateTimeFormatter DATE_FORMAT_NY
public static final java.time.format.DateTimeFormatter DATE_FORMAT_EST
public static final java.time.format.DateTimeFormatter DATETIME_FORMAT
public static Date getZoneDate(String time, TimeZoneId zoneId)
public static Long getTimestamp(String time, TimeZoneId zoneId)
public static boolean isDateBeforeToday(String date)
date - "yyyy-MM-dd"public static boolean isDateBeforeToday(String date, TimeZoneId zoneId)
date - "yyyy-MM-dd"zoneId - TimeZoneIdpublic static long parseEpochMill(String date, TimeZoneId zoneId)
date - "yyyy-MM-dd"zoneId - TimeZoneIdpublic static long parseEpochMill(java.time.LocalDate localDate)
public static long parseEpochMill(java.time.LocalDate localDate,
TimeZoneId zoneId)
public static String printTimeZoneET(long timestamp)
timestamp - public static String printDateTime(long timestamp, java.time.format.DateTimeFormatter formatter, TimeZoneId timeZoneId)
timestamp - formatter - timeZoneId - public static String printDate(long timestamp, TimeZoneId timeZoneId)
timestamp - public static String printSystemDate()
public static String printSystemDate(TimeZoneId timeZoneId)
Copyright © 2025. All rights reserved.