Package com.alibaba.fastjson2.util
Class DateUtils
java.lang.Object
com.alibaba.fastjson2.util.DateUtils
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringformat(int year, int month, int dayOfMonth) static Stringformat(int year, int month, int dayOfMonth, int hour, int minute, int second) static Stringformat(int year, int month, int dayOfMonth, DateUtils.DateTimeFormatPattern pattern) static Stringformat(long timeMillis) static Stringformat(long timeMillis, DateUtils.DateTimeFormatPattern pattern) static Stringstatic Stringformat(LocalDateTime ldt, String format) static Stringformat(ZonedDateTime zdt, String format) static Stringstatic Stringstatic StringformatYMD10(int year, int month, int dayOfMonth) static StringformatYMD10(long timeMillis, ZoneId zoneId) static StringformatYMD10(LocalDate date) static StringformatYMD10(Date date) static StringformatYMD8(long timeMillis, ZoneId zoneId) static StringformatYMD8(LocalDate date) static StringformatYMD8(Date date) static StringformatYMDHMS19(LocalDate localDate) static Stringstatic Stringstatic StringformatYMDHMS19(Date date) static StringformatYMDHMS19(Date date, ZoneId zoneId) static intgetShanghaiZoneOffsetTotalSeconds(long seconds) static ZoneIdstatic inthourAfterNoon(char h0, char h1) static booleanstatic booleanisLocalDate(String str) static booleanisLocalTime(String str) static LocalDateTimelocalDateTime(char y0, char y1, char y2, char y3, char m0, char m1, char d0, char d1, char h0, char h1, char i0, char i1, char s0, char s1) static LocalDateTimelocalDateTime(char y0, char y1, char y2, char y3, char m0, char m1, char d0, char d1, char h0, char h1, char i0, char i1, char s0, char s1, char S0, char S1, char S2, char S3, char S4, char S5, char S6, char S7, char S8) static longmillis(LocalDateTime ldt) static longmillis(LocalDateTime ldt, ZoneId zoneId) static longmillis(ZoneId zoneId, int year, int month, int dom, int hour, int minute, int second, int nanoOfSecond) static intmonth(char c0, char c1, char c2) static Datestatic Datestatic Datestatic Datestatic DateparseDateYMDHMS19(String str) static LocalDateparseLocalDate(byte[] str, int off, int len) static LocalDateparseLocalDate(char[] str, int off, int len) static LocalDateparseLocalDate(String str) static LocalDateparseLocalDate10(byte[] str, int off) yyyy-MM-dd yyyy/MM/dd MM/dd/yyyy dd.MM.yyyy yyyy年M月dd日 yyyy年MM月d日 yyyy MMM dstatic LocalDateparseLocalDate10(char[] str, int off) yyyy-MM-dd yyyy/MM/dd MM/dd/yyyy dd.MM.yyyy yyyy年M月dd日 yyyy年MM月d日 yyyy MMM dstatic LocalDateparseLocalDate11(byte[] str, int off) static LocalDateparseLocalDate11(char[] str, int off) yyyy年MM月dd日 yyyy년MM월dd일static LocalDateparseLocalDate8(byte[] str, int off) yyyy-m-d yyyyMMdd d-MMM-yystatic LocalDateparseLocalDate8(char[] str, int off) yyyy-m-d yyyyMMdd d-MMM-yystatic LocalDateparseLocalDate9(byte[] str, int off) yyyy-MM-d yyyy-M-dd dd-MMM-yystatic LocalDateparseLocalDate9(char[] str, int off) yyyy-MM-d yyyy-M-dd dd-MMM-yystatic LocalDateTimeparseLocalDateTime(byte[] str, int off, int len) static LocalDateTimeparseLocalDateTime(char[] str, int off, int len) static LocalDateTimeparseLocalDateTime(String str) static LocalDateTimeparseLocalDateTime(String str, int off, int len) static LocalDateTimeparseLocalDateTime12(byte[] str, int off) parseLocalDateTime use format 'yyyyMMddHHmm'static LocalDateTimeparseLocalDateTime12(char[] str, int off) static LocalDateTimeparseLocalDateTime14(byte[] str, int off) yyyyMMddHHmmssstatic LocalDateTimeparseLocalDateTime14(char[] str, int off) yyyyMMddHHmmssstatic LocalDateTimeparseLocalDateTime16(byte[] str, int off) yyyy-MM-ddTHH:mm yyyy-MM-dd HH:mm yyyyMMddTHHmmssZ yyyy-MM-ddTH:m:s yyyy-MM-dd H:m:sstatic LocalDateTimeparseLocalDateTime16(char[] str, int off) yyyy-MM-ddTHH:mm yyyy-MM-dd HH:mm yyyyMMddTHHmmssZ yyyy-MM-ddTH:m:s yyyy-MM-dd H:m:sstatic LocalDateTimeparseLocalDateTime17(byte[] str, int off) yyyy-MM-ddTHH:mmZ yyyy-MM-dd HH:mmZ yyyy-M-dTHH:mm:ss yyyy-M-d HH:mm:ssstatic LocalDateTimeparseLocalDateTime17(char[] str, int off) yyyy-MM-ddTHH:mmZ yyyy-MM-dd HH:mmZ yyyy-M-dTHH:mm:ss yyyy-M-d HH:mm:ssstatic LocalDateTimeparseLocalDateTime18(byte[] str, int off) yyyy-M-ddTHH:mm:ss yyyy-M-dd HH:mm:ss yyyy-MM-dTHH:mm:ss yyyy-MM-d HH:mm:ss yyyy-MM-ddTH:mm:ss yyyy-MM-dd H:mm:ss yyyy-MM-ddTHH:m:ss yyyy-MM-dd HH:m:ss yyyy-MM-ddTHH:mm:s yyyy-MM-dd HH:mm:sstatic LocalDateTimeparseLocalDateTime18(char[] str, int off) yyyy-M-ddTHH:mm:ss yyyy-M-dd HH:mm:ss yyyy-MM-dTHH:mm:ss yyyy-MM-d HH:mm:ss yyyy-MM-ddTH:mm:ss yyyy-MM-dd H:mm:ss yyyy-MM-ddTHH:m:ss yyyy-MM-dd HH:m:ss yyyy-MM-ddTHH:mm:s yyyy-MM-dd HH:mm:sstatic LocalDateTimeparseLocalDateTime19(byte[] str, int off) yyyy-MM-ddTHH:mm:ss yyyy-MM-dd HH:mm:ss yyyy/MM/ddTHH:mm:ss yyyy/MM/dd HH:mm:ssstatic LocalDateTimeparseLocalDateTime19(char[] str, int off) yyyy-MM-ddTHH:mm:ss yyyy-MM-dd HH:mm:ss yyyy/MM/ddTHH:mm:ss yyyy/MM/dd HH:mm:ssstatic LocalDateTimeparseLocalDateTime19(String str, int off) static LocalDateTimeparseLocalDateTime20(byte[] str, int off) static LocalDateTimeparseLocalDateTime20(char[] str, int off) static LocalDateTimeparseLocalDateTime26(byte[] str, int off) static LocalDateTimeparseLocalDateTime26(char[] str, int off) static LocalDateTimeparseLocalDateTime27(byte[] str, int off) static LocalDateTimeparseLocalDateTime27(char[] str, int off) static LocalDateTimeparseLocalDateTime28(byte[] str, int off) static LocalDateTimeparseLocalDateTime28(char[] str, int off) static LocalDateTimeparseLocalDateTime29(byte[] str, int off) static LocalDateTimeparseLocalDateTime29(char[] str, int off) static LocalDateTimeparseLocalDateTimeX(byte[] str, int offset, int len) static LocalDateTimeparseLocalDateTimeX(char[] str, int offset, int len) static LocalTimeparseLocalTime(char c0, char c1, char c2, char c3, char c4, char c5, char c6, char c7) static LocalTimeparseLocalTime10(byte[] bytes, int off) static LocalTimeparseLocalTime10(char[] bytes, int off) static LocalTimeparseLocalTime11(byte[] bytes, int off) static LocalTimeparseLocalTime11(char[] bytes, int off) static LocalTimeparseLocalTime12(byte[] bytes, int off) static LocalTimeparseLocalTime12(char[] bytes, int off) static LocalTimeparseLocalTime18(byte[] bytes, int off) static LocalTimeparseLocalTime18(char[] bytes, int off) static LocalTimeparseLocalTime5(byte[] bytes, int off) static LocalTimeparseLocalTime5(char[] chars, int off) static LocalTimeparseLocalTime6(byte[] bytes, int off) static LocalTimeparseLocalTime6(char[] chars, int off) static LocalTimeparseLocalTime7(byte[] bytes, int off) static LocalTimeparseLocalTime7(char[] chars, int off) static LocalTimeparseLocalTime8(byte[] bytes, int off) static LocalTimeparseLocalTime8(char[] bytes, int off) static longparseMillis(byte[] bytes, int off, int len) static longparseMillis(byte[] bytes, int off, int len, Charset charset) static longparseMillis(byte[] chars, int off, int len, Charset charset, ZoneId zoneId) static longparseMillis(char[] bytes, int off, int len) static longparseMillis(char[] chars, int off, int len, ZoneId zoneId) static longparseMillis(String str) static longparseMillis(String str, ZoneId zoneId) static longparseMillis19(byte[] bytes, int off, ZoneId zoneId) static longparseMillis19(char[] bytes, int off, ZoneId zoneId) static longparseMillis19(String str, ZoneId zoneId) static longparseMillisYMDHMS19(String str, ZoneId zoneId) static ZonedDateTimeparseZonedDateTime(byte[] str, int off, int len) static ZonedDateTimeparseZonedDateTime(byte[] str, int off, int len, ZoneId defaultZoneId) static ZonedDateTimeparseZonedDateTime(char[] str, int off, int len) static ZonedDateTimeparseZonedDateTime(char[] str, int off, int len, ZoneId defaultZoneId) static ZonedDateTimeparseZonedDateTime(String str) static ZonedDateTimeparseZonedDateTime(String str, ZoneId defaultZoneId) static intreadNanos(byte[] bytes, int len, int offset) static intreadNanos(char[] chars, int len, int offset) static Stringstatic Stringstatic longutcSeconds(int year, int month, int dom, int hour, int minute, int second)
-
Field Details
-
DEFAULT_ZONE_ID
-
SHANGHAI_ZONE_ID_NAME
- See Also:
-
SHANGHAI_ZONE_ID
-
SHANGHAI_ZONE_RULES
-
OFFSET_8_ZONE_ID_NAME
- See Also:
-
OFFSET_8_ZONE_ID
-
LOCAL_DATE_19700101
-
-
Constructor Details
-
DateUtils
public DateUtils()
-
-
Method Details
-
parseDateYMDHMS19
-
parseDate
-
parseDate
-
parseDate
-
parseDate
-
parseMillis
-
parseMillis
-
parseLocalDateTime
-
parseLocalDateTime
-
parseLocalDateTime
-
parseLocalTime5
-
parseLocalTime5
-
parseLocalTime6
-
parseLocalTime6
-
parseLocalTime7
-
parseLocalTime7
-
parseLocalTime8
-
parseLocalTime8
-
parseLocalTime
public static LocalTime parseLocalTime(char c0, char c1, char c2, char c3, char c4, char c5, char c6, char c7) -
parseLocalTime10
-
parseLocalTime10
-
parseLocalTime11
-
parseLocalTime11
-
parseLocalTime12
-
parseLocalTime12
-
parseLocalTime18
-
parseLocalTime18
-
parseLocalDateTime
-
parseLocalDate
-
parseLocalDate
-
parseLocalDate
-
parseMillis
public static long parseMillis(byte[] bytes, int off, int len) -
parseMillis
-
parseMillis
-
parseMillis
public static long parseMillis(char[] bytes, int off, int len) -
parseMillis
-
parseLocalDate8
yyyy-m-d yyyyMMdd d-MMM-yy -
parseLocalDate8
yyyy-m-d yyyyMMdd d-MMM-yy -
parseLocalDate9
yyyy-MM-d yyyy-M-dd dd-MMM-yy -
parseLocalDate9
yyyy-MM-d yyyy-M-dd dd-MMM-yy -
parseLocalDate10
yyyy-MM-dd yyyy/MM/dd MM/dd/yyyy dd.MM.yyyy yyyy年M月dd日 yyyy年MM月d日 yyyy MMM d -
parseLocalDate10
yyyy-MM-dd yyyy/MM/dd MM/dd/yyyy dd.MM.yyyy yyyy年M月dd日 yyyy年MM月d日 yyyy MMM d -
parseLocalDate11
yyyy年MM月dd日 yyyy년MM월dd일 -
parseLocalDate11
-
parseLocalDateTime12
-
parseLocalDateTime12
parseLocalDateTime use format 'yyyyMMddHHmm' -
parseLocalDateTime14
yyyyMMddHHmmss -
parseLocalDateTime14
yyyyMMddHHmmss -
parseLocalDateTime16
yyyy-MM-ddTHH:mm yyyy-MM-dd HH:mm yyyyMMddTHHmmssZ yyyy-MM-ddTH:m:s yyyy-MM-dd H:m:s -
parseLocalDateTime16
yyyy-MM-ddTHH:mm yyyy-MM-dd HH:mm yyyyMMddTHHmmssZ yyyy-MM-ddTH:m:s yyyy-MM-dd H:m:s -
parseLocalDateTime17
yyyy-MM-ddTHH:mmZ yyyy-MM-dd HH:mmZ yyyy-M-dTHH:mm:ss yyyy-M-d HH:mm:ss -
parseLocalDateTime17
yyyy-MM-ddTHH:mmZ yyyy-MM-dd HH:mmZ yyyy-M-dTHH:mm:ss yyyy-M-d HH:mm:ss -
parseLocalDateTime18
yyyy-M-ddTHH:mm:ss yyyy-M-dd HH:mm:ss yyyy-MM-dTHH:mm:ss yyyy-MM-d HH:mm:ss yyyy-MM-ddTH:mm:ss yyyy-MM-dd H:mm:ss yyyy-MM-ddTHH:m:ss yyyy-MM-dd HH:m:ss yyyy-MM-ddTHH:mm:s yyyy-MM-dd HH:mm:s -
parseLocalDateTime18
yyyy-M-ddTHH:mm:ss yyyy-M-dd HH:mm:ss yyyy-MM-dTHH:mm:ss yyyy-MM-d HH:mm:ss yyyy-MM-ddTH:mm:ss yyyy-MM-dd H:mm:ss yyyy-MM-ddTHH:m:ss yyyy-MM-dd HH:m:ss yyyy-MM-ddTHH:mm:s yyyy-MM-dd HH:mm:s -
parseLocalDateTime19
yyyy-MM-ddTHH:mm:ss yyyy-MM-dd HH:mm:ss yyyy/MM/ddTHH:mm:ss yyyy/MM/dd HH:mm:ss -
parseLocalDateTime19
-
parseLocalDateTime19
yyyy-MM-ddTHH:mm:ss yyyy-MM-dd HH:mm:ss yyyy/MM/ddTHH:mm:ss yyyy/MM/dd HH:mm:ss -
parseLocalDateTime20
-
parseLocalDateTime20
-
parseLocalDateTime26
-
parseLocalDateTime26
-
parseLocalDateTime27
-
parseLocalDateTime27
-
parseLocalDateTime28
-
parseLocalDateTime28
-
parseLocalDateTime29
-
parseLocalDateTime29
-
parseLocalDateTimeX
-
parseLocalDateTimeX
-
parseZonedDateTime
-
parseZonedDateTime
-
parseZonedDateTime
-
parseZonedDateTime
-
parseZonedDateTime
-
parseZonedDateTime
-
getZoneId
-
parseMillisYMDHMS19
-
parseMillis19
-
parseMillis19
-
parseMillis19
-
localDateTime
public static LocalDateTime localDateTime(char y0, char y1, char y2, char y3, char m0, char m1, char d0, char d1, char h0, char h1, char i0, char i1, char s0, char s1) -
localDateTime
public static LocalDateTime localDateTime(char y0, char y1, char y2, char y3, char m0, char m1, char d0, char d1, char h0, char h1, char i0, char i1, char s0, char s1, char S0, char S1, char S2, char S3, char S4, char S5, char S6, char S7, char S8) -
millis
-
millis
-
millis
public static long millis(ZoneId zoneId, int year, int month, int dom, int hour, int minute, int second, int nanoOfSecond) -
utcSeconds
public static long utcSeconds(int year, int month, int dom, int hour, int minute, int second) -
formatYMDHMS19
-
formatYMDHMS19
-
formatYMD8
-
formatYMD8
-
formatYMD10
-
formatYMD10
-
formatYMD10
-
formatYMD8
-
formatYMD10
-
format
-
formatYMDHMS19
-
format
-
formatYMDHMS19
-
format
-
formatYMDHMS19
-
format
-
format
-
format
public static String format(int year, int month, int dayOfMonth, DateUtils.DateTimeFormatPattern pattern) -
format
-
format
-
format
-
format
-
toString
-
toString
-
month
public static int month(char c0, char c1, char c2) -
hourAfterNoon
public static int hourAfterNoon(char h0, char h1) -
getShanghaiZoneOffsetTotalSeconds
public static int getShanghaiZoneOffsetTotalSeconds(long seconds) -
isLocalDate
-
isDate
-
isLocalTime
-
readNanos
public static int readNanos(char[] chars, int len, int offset) -
readNanos
public static int readNanos(byte[] bytes, int len, int offset)
-