一、时间工具类:
package com.example.mongodbdemo.utils;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.*;
import java.util.*;
/**
* @author qzz
*/
public class DateUtils {
public static final String DATESHOWFORMAT = "yyyy-MM-dd";
public static final String DATETIMESHOWFORMAT = "yyyy-MM-dd HH:mm:ss";
/**
* 字符串转时间
*/
public static Date strToDate(String date,String formats){
SimpleDateFormat sdf = new SimpleDateFormat(formats);
ParsePosition parsePosition = new ParsePosition(0);
return sdf.parse(date,parsePosition);
}
/**
* 获得某天最小时间 2022-06-08 00:00:00
*/
public static Date getStartOfDay(Date date) {
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());
LocalDateTime startOfDay = localDateTime.with(LocalTime.MIN);
return Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant());
}
/**
* 获得某天最大时间 如:2022-06-08 23:59:59
*/
public static Date getEndOfDay(Date date) {
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());;
LocalDateTime endOfDay = localDateTime.with(LocalTime.MAX);
return Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant());
}
/**
* 日期格式化(Date转换为String)
*
* @param _date
* 日期
* @param patternString
* 处理结果日期的显示格式,如:"YYYY-MM-DD"
* @return
*/
public static String getDateString(Date _date, String patternString) {
String dateString = "";
if (_date != null) {
SimpleDateFormat formatter = new SimpleDateFormat(patternString);
dateString = formatter.format(_date);
}
return dateString;
}
/**
* 获取指定月第一天
*
* @return
*/
public static Date getFirstThisDate(Date date) {
Calendar ca = Calendar.getInstance();
ca.setTime(date);
ca.set(Calendar.DAY_OF_MONTH, 1);
Date firstDate = ca.getTime();
String dateString = getDateString(firstDate, DATESHOWFORMAT);
return getDateToString(dateString, DATESHOWFORMAT);
}
/**
* 获取指定时间的月份最后一天
* @param date
* @return
*/
public static Date getLastThisDate(Date date)
{
int year = getYear(date);
int month = getMonth(date);
Calendar cal = Calendar.getInstance();
//设置年份
cal.set(Calendar.YEAR,year);
//设置月份
cal.set(Calendar.MONTH, month-1);
//获取某月最大天数
int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
//设置日历中月份的最大天数
cal.set(Calendar.DAY_OF_MONTH, lastDay);
//格式化日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String lastDayOfMonth = sdf.format(cal.getTime()) + " 23:59:59";
return getDateToString(lastDayOfMonth, DATETIMESHOWFORMAT);
}
/**
* 获取日期的年
*
* @param date
* @return
*/
public static int getYear(Date date) {
Calendar ca = Calendar.getInstance();
ca.setTime(date);
return ca.get(Calendar.YEAR);
}
/**
* 获取日期的月
*
* @param date
* @return
*/
public static int getMonth(Date date) {
Calendar ca = Calendar.getInstance();
ca.setTime(date);
return ca.get(Calendar.MONTH) + 1;
}
/**
* 获取日期的日
*
* @param date
* @return
*/
public static int getDay(Date date) {
Calendar ca = Calendar.getInstance();
ca.setTime(date);
return ca.get(Calendar.DATE);
}
/**
* 日期格式化(String转换为Date)
*
* @param dateStr
* 日期字符串
* @param patten
* 处理结果日期的显示格式,如:"YYYY-MM-DD"
* @return
*/
public static Date getDateToString(String dateStr, String patten) {
if (StringUtils.isBlank(dateStr)) {
return null;
}
SimpleDateFormat formatter = new SimpleDateFormat(patten, Locale.CHINA);
try {
return formatter.parse(dateStr);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 打印指定年份的第一天
*
* @param year 年份
*/
public static String getFirstDateForYear(int year) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, calendar.getActualMinimum(Calendar.MONTH));
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
return new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
}
/**
* 打印指定年份的最后一天
*
* @param year 年份
*/
public static String getLastDateForYear(int year) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, calendar.getActualMaximum(Calendar.MONTH));
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
return new SimpleDateFormat("yyyy-MM-dd").format(calendar.getTime());
}
// 获得当前周- 周一的日期
public static List<String> getTimeInterval(int days) {
LocalDate begin = LocalDate.now().minusDays(days - 1 );
List<String> list = new ArrayList();
for (int i = 0; i < days; i++) {
list.add(begin.toString());
begin = begin.plusDays(1);
}
return list;
}
/**
* 时间字符串截取 日期值
*/
public static String strToDateValue(String date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
ParsePosition parsePosition = new ParsePosition(0);
return sdf.format(sdf.parse(date,parsePosition));
}
}
二、应用
功能:
1.字符串 转 时间
2.时间 转 字符串
3.指定月的第一天、最后一天
4.指定年的第一天、最后一天
5.近30天的第一天、最后一天
6.近7天的第一天、最后一天
package com.example.mongodbdemo.utils;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
/**
* @author qzz
*/
public class DateUtilsTest {
public static void main(String[] args) {
//1.字符串 转 时间
String time ="2022-06-09 15:53:00";
Date date = DateUtils.strToDate(time,"yyyy-MM-dd HH:mm:ss");
System.out.println("字符串 转 时间:"+date);
//2.时间 转 字符串
Date now = new Date();
String nowStr = DateUtils.getDateString(now,"yyyy-MM-dd");
System.out.println("时间 转 字符串:"+nowStr);
//3.指定月的第一天、最后一天
String t1= DateUtils.getDateString(DateUtils.getFirstThisDate(now),"yyyy-MM-dd");
String t2= DateUtils.getDateString(DateUtils.getLastThisDate(now),"yyyy-MM-dd");
System.out.println("获取指定月第一天为:" + t1);
System.out.println("获取指定月最后一天为:" + t2);
//4.指定年的第一天、最后一天
String t11= DateUtils.getFirstDateForYear(2022);
String t21= DateUtils.getLastDateForYear(2022);
System.out.println("获取指定年第一天为:" + t11);
System.out.println("获取指定年最后一天为:" + t21);
//近30天
LocalDateTime beginTime;
LocalDateTime endTime;
List<String> timeIntervalList;
beginTime = LocalDateTime.of(LocalDateTime.now().minusDays(29).toLocalDate(), LocalTime.MIN).plusHours(8);
endTime = LocalDateTime.of(LocalDateTime.now().toLocalDate(), LocalTime.MAX).plusHours(8);
timeIntervalList = DateUtils.getTimeInterval(30);
System.out.println("近30天的第一天:"+beginTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
System.out.println("近30天的最后一天:"+endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
// timeIntervalList.forEach(t->{
// System.out.println(t);
// });
//近7天
beginTime = LocalDateTime.of(LocalDateTime.now().minusDays(6).toLocalDate(), LocalTime.MIN).plusHours(8);
endTime = LocalDateTime.of(LocalDate.now(), LocalTime.MAX).plusHours(8);
timeIntervalList = DateUtils.getTimeInterval(7);
System.out.println("近7天的第一天:"+beginTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
System.out.println("近7天的最后一天:"+endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
}
}
运行结果:
"D:\Program Files\Java\jdk1.8.0_40\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\lib\idea_rt.jar=62512:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\bin" -Dfile.encoding=UTF-8 -classpath "D:\Program Files\Java\jdk1.8.0_40\jre\lib\charsets.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\deploy.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\access-bridge-64.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\cldrdata.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\dnsns.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\jaccess.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\jfxrt.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\localedata.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\nashorn.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\sunec.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\sunjce_provider.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\sunmscapi.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\sunpkcs11.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\zipfs.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\javaws.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\jce.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\jfr.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\jfxswt.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\jsse.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\management-agent.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\plugin.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\resources.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\rt.jar;F:\study-project\mongodb-demo\target\classes;D:\mvnrepository\org\springframework\boot\spring-boot-starter-web\2.6.7\spring-boot-starter-web-2.6.7.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter\2.6.7\spring-boot-starter-2.6.7.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter-logging\2.6.7\spring-boot-starter-logging-2.6.7.jar;D:\mvnrepository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\mvnrepository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\mvnrepository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\mvnrepository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\mvnrepository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\mvnrepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\mvnrepository\org\yaml\snakeyaml\1.29\snakeyaml-1.29.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter-json\2.6.7\spring-boot-starter-json-2.6.7.jar;D:\mvnrepository\com\fasterxml\jackson\core\jackson-databind\2.13.2.1\jackson-databind-2.13.2.1.jar;D:\mvnrepository\com\fasterxml\jackson\core\jackson-annotations\2.13.2\jackson-annotations-2.13.2.jar;D:\mvnrepository\com\fasterxml\jackson\core\jackson-core\2.13.2\jackson-core-2.13.2.jar;D:\mvnrepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.2\jackson-datatype-jdk8-2.13.2.jar;D:\mvnrepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.2\jackson-datatype-jsr310-2.13.2.jar;D:\mvnrepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.2\jackson-module-parameter-names-2.13.2.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter-tomcat\2.6.7\spring-boot-starter-tomcat-2.6.7.jar;D:\mvnrepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.62\tomcat-embed-core-9.0.62.jar;D:\mvnrepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.62\tomcat-embed-el-9.0.62.jar;D:\mvnrepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.62\tomcat-embed-websocket-9.0.62.jar;D:\mvnrepository\org\springframework\spring-web\5.3.19\spring-web-5.3.19.jar;D:\mvnrepository\org\springframework\spring-beans\5.3.19\spring-beans-5.3.19.jar;D:\mvnrepository\org\springframework\spring-webmvc\5.3.19\spring-webmvc-5.3.19.jar;D:\mvnrepository\org\springframework\spring-aop\5.3.19\spring-aop-5.3.19.jar;D:\mvnrepository\org\springframework\spring-context\5.3.19\spring-context-5.3.19.jar;D:\mvnrepository\org\springframework\spring-expression\5.3.19\spring-expression-5.3.19.jar;D:\mvnrepository\org\springframework\boot\spring-boot-devtools\2.6.7\spring-boot-devtools-2.6.7.jar;D:\mvnrepository\org\springframework\boot\spring-boot\2.6.7\spring-boot-2.6.7.jar;D:\mvnrepository\org\springframework\boot\spring-boot-autoconfigure\2.6.7\spring-boot-autoconfigure-2.6.7.jar;D:\mvnrepository\org\projectlombok\lombok\1.18.24\lombok-1.18.24.jar;D:\mvnrepository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\mvnrepository\org\springframework\spring-core\5.3.19\spring-core-5.3.19.jar;D:\mvnrepository\org\springframework\spring-jcl\5.3.19\spring-jcl-5.3.19.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter-data-mongodb\2.6.7\spring-boot-starter-data-mongodb-2.6.7.jar;D:\mvnrepository\org\mongodb\mongodb-driver-sync\4.4.2\mongodb-driver-sync-4.4.2.jar;D:\mvnrepository\org\mongodb\bson\4.4.2\bson-4.4.2.jar;D:\mvnrepository\org\mongodb\mongodb-driver-core\4.4.2\mongodb-driver-core-4.4.2.jar;D:\mvnrepository\org\springframework\data\spring-data-mongodb\3.3.4\spring-data-mongodb-3.3.4.jar;D:\mvnrepository\org\springframework\spring-tx\5.3.19\spring-tx-5.3.19.jar;D:\mvnrepository\org\springframework\data\spring-data-commons\2.6.4\spring-data-commons-2.6.4.jar;D:\mvnrepository\org\apache\commons\commons-lang3\3.7\commons-lang3-3.7.jar" com.example.mongodbdemo.utils.DateUtilsTest
字符串 转 时间:Thu Jun 09 15:53:00 CST 2022
时间 转 字符串:2022-06-09
获取指定月第一天为:2022-06-01
获取指定月最后一天为:2022-06-30
获取指定年第一天为:2022-01-01
获取指定年最后一天为:2022-12-31
近30天的第一天:2022-05-11
近30天的最后一天:2022-06-10
近7天的第一天:2022-06-03
近7天的最后一天:2022-06-10
Process finished with exit code 0
功能:
1.本日 开始时间 结束时间
2.本月 开始时间 结束时间
3.本年 开始时间 结束时间
package com.example.mongodbdemo.utils;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @author qzz
*/
public class DateUtilsTest1 {
public static void main(String[] args) {
Date now = new Date();
LocalDateTime localDateTime = LocalDateTime.now();
//本日 开始时间 2022-06-08 00:00:00
String begin = DateUtils.getDateString(DateUtils.getStartOfDay(now),"yyyy-MM-dd HH:mm:ss");
//本日 结束时间 2022-06-08 23:59:59
String end = DateUtils.getDateString(DateUtils.getEndOfDay(now),"yyyy-MM-dd HH:mm:ss");
System.out.println("本日 开始时间:"+begin);
System.out.println("本日 结束时间:"+end);
//本月 第一天 如:2022-06-01
String startTime11= DateUtils.getDateString(DateUtils.getFirstThisDate(now),"yyyy-MM-dd HH:mm:ss");
//本月 最后一天 如:2022-06-30
String endTime11= DateUtils.getDateString(DateUtils.getLastThisDate(now),"yyyy-MM-dd HH:mm:ss");
System.out.println("本月 开始时间:"+startTime11);
System.out.println("本月 结束时间:"+endTime11);
//本年 开始时间 如:2022-01-01 00:00:00
String startTime1= DateUtils.getFirstDateForYear(localDateTime.getYear())+" 00:00:00";
//本年 结束时间 如:2022-12-31 23:59:59
String endTime1= DateUtils.getLastDateForYear(localDateTime.getYear())+" 23:59:59";
System.out.println("本年 开始时间:"+startTime1);
System.out.println("本年 结束时间:"+endTime1);
}
}
"D:\Program Files\Java\jdk1.8.0_40\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\lib\idea_rt.jar=62555:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\bin" -Dfile.encoding=UTF-8 -classpath "D:\Program Files\Java\jdk1.8.0_40\jre\lib\charsets.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\deploy.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\access-bridge-64.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\cldrdata.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\dnsns.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\jaccess.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\jfxrt.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\localedata.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\nashorn.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\sunec.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\sunjce_provider.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\sunmscapi.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\sunpkcs11.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\ext\zipfs.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\javaws.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\jce.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\jfr.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\jfxswt.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\jsse.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\management-agent.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\plugin.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\resources.jar;D:\Program Files\Java\jdk1.8.0_40\jre\lib\rt.jar;F:\study-project\mongodb-demo\target\classes;D:\mvnrepository\org\springframework\boot\spring-boot-starter-web\2.6.7\spring-boot-starter-web-2.6.7.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter\2.6.7\spring-boot-starter-2.6.7.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter-logging\2.6.7\spring-boot-starter-logging-2.6.7.jar;D:\mvnrepository\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\mvnrepository\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\mvnrepository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\mvnrepository\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\mvnrepository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\mvnrepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\mvnrepository\org\yaml\snakeyaml\1.29\snakeyaml-1.29.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter-json\2.6.7\spring-boot-starter-json-2.6.7.jar;D:\mvnrepository\com\fasterxml\jackson\core\jackson-databind\2.13.2.1\jackson-databind-2.13.2.1.jar;D:\mvnrepository\com\fasterxml\jackson\core\jackson-annotations\2.13.2\jackson-annotations-2.13.2.jar;D:\mvnrepository\com\fasterxml\jackson\core\jackson-core\2.13.2\jackson-core-2.13.2.jar;D:\mvnrepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.2\jackson-datatype-jdk8-2.13.2.jar;D:\mvnrepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.2\jackson-datatype-jsr310-2.13.2.jar;D:\mvnrepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.2\jackson-module-parameter-names-2.13.2.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter-tomcat\2.6.7\spring-boot-starter-tomcat-2.6.7.jar;D:\mvnrepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.62\tomcat-embed-core-9.0.62.jar;D:\mvnrepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.62\tomcat-embed-el-9.0.62.jar;D:\mvnrepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.62\tomcat-embed-websocket-9.0.62.jar;D:\mvnrepository\org\springframework\spring-web\5.3.19\spring-web-5.3.19.jar;D:\mvnrepository\org\springframework\spring-beans\5.3.19\spring-beans-5.3.19.jar;D:\mvnrepository\org\springframework\spring-webmvc\5.3.19\spring-webmvc-5.3.19.jar;D:\mvnrepository\org\springframework\spring-aop\5.3.19\spring-aop-5.3.19.jar;D:\mvnrepository\org\springframework\spring-context\5.3.19\spring-context-5.3.19.jar;D:\mvnrepository\org\springframework\spring-expression\5.3.19\spring-expression-5.3.19.jar;D:\mvnrepository\org\springframework\boot\spring-boot-devtools\2.6.7\spring-boot-devtools-2.6.7.jar;D:\mvnrepository\org\springframework\boot\spring-boot\2.6.7\spring-boot-2.6.7.jar;D:\mvnrepository\org\springframework\boot\spring-boot-autoconfigure\2.6.7\spring-boot-autoconfigure-2.6.7.jar;D:\mvnrepository\org\projectlombok\lombok\1.18.24\lombok-1.18.24.jar;D:\mvnrepository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\mvnrepository\org\springframework\spring-core\5.3.19\spring-core-5.3.19.jar;D:\mvnrepository\org\springframework\spring-jcl\5.3.19\spring-jcl-5.3.19.jar;D:\mvnrepository\org\springframework\boot\spring-boot-starter-data-mongodb\2.6.7\spring-boot-starter-data-mongodb-2.6.7.jar;D:\mvnrepository\org\mongodb\mongodb-driver-sync\4.4.2\mongodb-driver-sync-4.4.2.jar;D:\mvnrepository\org\mongodb\bson\4.4.2\bson-4.4.2.jar;D:\mvnrepository\org\mongodb\mongodb-driver-core\4.4.2\mongodb-driver-core-4.4.2.jar;D:\mvnrepository\org\springframework\data\spring-data-mongodb\3.3.4\spring-data-mongodb-3.3.4.jar;D:\mvnrepository\org\springframework\spring-tx\5.3.19\spring-tx-5.3.19.jar;D:\mvnrepository\org\springframework\data\spring-data-commons\2.6.4\spring-data-commons-2.6.4.jar;D:\mvnrepository\org\apache\commons\commons-lang3\3.7\commons-lang3-3.7.jar" com.example.mongodbdemo.utils.DateUtilsTest1
本日 开始时间:2022-06-09 00:00:00
本日 结束时间:2022-06-09 23:59:59
本月 开始时间:2022-06-01 00:00:00
本月 结束时间:2022-06-30 23:59:59
本年 开始时间:2022-01-01 00:00:00
本年 结束时间:2022-12-31 23:59:59
Process finished with exit code 0