首页数据
This commit is contained in:
@@ -3,8 +3,13 @@ package com.chaozhanggui.system.cashierservice.util;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* Created by SEELE on 2018/4/19.
|
||||
@@ -242,6 +247,36 @@ public class DateUtils {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 今天结束时间
|
||||
* @return
|
||||
*/
|
||||
public static Date getDayEnd() {
|
||||
Calendar cal = new GregorianCalendar();
|
||||
cal.set(Calendar.HOUR_OF_DAY, 23);
|
||||
cal.set(Calendar.MINUTE, 59);
|
||||
cal.set(Calendar.SECOND, 59);
|
||||
cal.set(Calendar.MILLISECOND, 999);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
public static String getTodayEndTimeAsString() {
|
||||
// 获取今天的日期
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
// 创建今天的结束时间(23:59:59.999)
|
||||
LocalTime endTime = LocalTime.of(23, 59, 59, 999_000_000);
|
||||
|
||||
// 组合日期和时间
|
||||
LocalDateTime todayEndTime = LocalDateTime.of(today, endTime);
|
||||
|
||||
// 格式化时间
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
|
||||
// 转换为字符串
|
||||
return todayEndTime.format(formatter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到n天之后是周几
|
||||
* @param days
|
||||
|
||||
Reference in New Issue
Block a user