Commit 9121a80b by wangli

新增字符串转换为localtime

1 parent b867c9b6
......@@ -3,13 +3,14 @@ package com.dituhui.pea.order.common;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
public class TimeUtils {
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static final String DATE_NO_GAP_FORMAT = "yyyyMMdd";
public static final String DATE_GAP_FORMAT = "yyyy-MM-dd";
public static final String TIME_HH_MM_FORMAT = "HHmm";
public static final String TIME_HH_MM_FORMAT = "HH:mm";
public static final String IsoTimestamp2DateTime(Timestamp timestamp) {
// Timestamp转换为日期时间字符串
......@@ -51,6 +52,10 @@ public class TimeUtils {
return localDate.format(DateTimeFormatter.ofPattern(DATE_GAP_FORMAT));
}
public static final LocalTime time2LocalTime(String s) {
return LocalTime.parse(s, DateTimeFormatter.ofPattern(TIME_HH_MM_FORMAT));
}
public static final LocalDate addDays(LocalDate date, long days) {
return date.plusDays(days);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!