package com.puboot.common.util;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
/**
* 日期工具类
*
* @author Linzhaoguan
* @version V1.0
* @date 2019年9月11日
*/
@Slf4j
@UtilityClass
public class DateUtil {
public static final long ONE_DAY_SECONDS = 86400;
public static final String SHORT_FORMAT = "yyyyMMdd";
public static final String LONG_FORMAT = "yyyyMMddHHmmss";
public static final String concurrentFormat = "yyyyMMddHHmmssSSS";
public static final String shortConcurrentFormat = "yyMMddHHmmssSSS";
public static final String webFormat = "yyyy-MM-dd";
public static final String webMonthFormat = "yyyy-MM";
public static final String timeFormat = "HH:mm:ss";
public static final String monthFormat = "yyyyMM";
public static final String chineseDtFormat = "yyyy年MM月dd日";
public static final String chineseYMFormat = "yyyy年MM月";
public static final String newFormat = "yyyy-MM-dd HH:mm:ss";
public static final String noSecondFormat = "yyyy-MM-dd HH:mm";
public static final String MdFormat = "MM-dd";
public static final long ONE_DAY_MILL_SECONDS = 86400000;
public static DateFormat getNewDateFormat(String pattern) {
DateFormat df = new SimpleDateFormat(pattern);
df.setLenient(false);
return df;
}
public static String format(Date date, String format) {
return new SimpleDateFormat(format).format(date);
}
public static String format(String dateStr, String oldFormat, String newFormat) throws ParseException {
String result = null;
DateFormat oldDateFormat = new SimpleDateFormat(oldFormat);
DateFormat newDateFormat = new SimpleDateFormat(newFormat);
Date date = oldDateFormat.parse(dateStr);
result = newDateFormat.format(date);
return result;
}
public static Date parseDateNoTime(String sDate) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat(SHORT_FORMAT);
return dateFormat.parse(sDate);
}
public static Date parseDateNoTime(String sDate, String format) throws ParseException {
if (StrUtil.isBlank(format)) {
throw new ParseException("Null format. ", 0);
}
DateFormat dateFormat = new SimpleDateFormat(format);
return dateFormat.parse(sDate);
}
public static Date parseDateNoTimeWithDelimit(String sDate, String delimit) throws ParseException {
sDate = sDate.replaceAll(delimit, "");
DateFormat dateFormat = new SimpleDateFormat(SHORT_FORMAT);
return dateFormat.parse(sDate);
}
public static Date parseDateLongFormat(String sDate) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat(LONG_FORMAT);
return dateFormat.parse(sDate);
}
public static Date parseDateNewFormat(String sDate) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat(newFormat);
dateFormat.setLenient(false);
return dateFormat.parse(sDate);
}
public static Date parseDateNoSecondFormat(String sDate) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat(noSecondFormat);
dateFormat.setLenient(false);
return dateFormat.parse(sDate);
}
public static Date parseDateWebFormat(String sDate) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat(webFormat);
dateFormat.setLenient(false);
return dateFormat.parse(sDate);
}
public static Date parseDateWebMonthFormat(String sDate) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat(webMonthFormat);
dateFormat.setLenient(false);
return dateFormat.parse(sDate);
}
/**
* 计算当前时间几小时之后的时间
*
* @param date
* @param hours
* @return
*/
public static Date addHours(Date date, long hours) {
return addMinutes(date, hours * 60);
}
/**
* 计算当前时间几分钟之后的时间
*
* @param date
* @param minutes
* @return
*/
public static Date addMinutes(Date date, long minutes) {
return addSeconds(date, minutes * 60);
}
/**
* @param date1
* @param secs
* @return
*/
public static Date addSeconds(Date date1, long secs) {
return new Date(date1.getTime() + secs * 1000);
}
/**
* 判断输入的字符串是否为合法的小时
*
* @param hourStr
* @return true/false
*/
public static boolean isValidHour(String hourStr) {
if (NumberUtil.isNumber(hourStr)) {
int hour = Integer.parseInt(hourStr);
return hour >= 0 && hour <= 23;
}
return false;
}
/**
* 判断输入的字符串是否为合法的分或秒
*
* @param str
* @return true/false
*/
public static boolean isValidMinuteOrSecond(String str) {
if (NumberUtil.isNumber(str)) {
int hour = Integer.parseInt(str);
return hour >= 0 && hour <= 59;
}
return false;
}
/**
* 取得新的日期
*
* @param date1 日期
* @param days 天数
* @return 新的日期
*/
public static Date addDays(Date date1, long days) {
Calendar cal = Calendar.getInstance();
cal.setTime(date1);
cal.add(Calendar.DATE, (int) days);
return cal.getTime();
}
public static String getTomorrowDateString(String sDate) throws ParseException {
Date aDate = parseDateNoTime(sDate);
aDate = addSeconds(aDate, ONE_DAY_SECONDS);
return getDateString(aDate);
}
public static String getTomorrowDateNewFMTString(String sDate) throws ParseException {
Date aDate = parseDateWebFormat(sDate);
aDate = addDays(aDate, 1);
return getWebDateString(aDate);
}
public static String getTomorrowDateNewFormatString(String sDate) throws ParseException {
Date aDate = parseDateNewFormat(sDate);
aDate = addDays(aDate, 1);
return getWebDateString(aDate);
}
public static String getLongDateString(Date date) {
DateFormat dateFormat = new SimpleDateFormat(LONG_FORMAT);
return getDateString(date, dateFormat);
}
public static String getNewFormatDateString(Date date) {
DateFormat dateFormat = new SimpleDateFormat(newFormat);
return getDateString(date, dateFormat);
}
public static String getWebFormatDateString(Date date) {
DateFormat dateFormat = new SimpleDateFormat(webFormat);
return getDateString(date, dateFormat);
}
public static String getConcurrentFormatDateString(Date date) {
DateFormat dateFormat = new SimpleDateFormat(concurrentFormat);
return getDateString(date, dateFormat);
}
public static String getDateString(Date date, DateFormat dateFormat) {
if (date == null || dateFormat == null) {
return null;
}
return dateFormat.format(date);
}
public static String getYesterDayDateString(String sDate) throws ParseException {
Date aDate = parseDateNoTime(sDate);
aDate = addSeconds(aDate, -ONE_DAY_SECONDS);
return getDateString(aDate);
}
/**
* @return 当天的时间格式化为"yyyyMMdd"
*/
public static String getDateString(Date date) {
DateFormat df = getNewDateFormat(SHORT_FORMAT);
return df.format(date);
}
public static String getWebDateString(Date date) {
DateFormat dateFormat = getNewDateFormat(webFormat);
return getDat
没有合适的资源?快使用搜索试试~ 我知道了~
基于SpringBoot的内容管理系统设计源码
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共2000个文件
js:555个
svg:523个
css:316个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 36 浏览量
2024-04-04
04:34:14
上传
评论
收藏 70.77MB ZIP 举报
温馨提示
本设计源码提供了一个基于SpringBoot的内容管理系统。项目包含2005个文件,主要使用JavaScript、CSS、Java、TypeScript和HTML编程语言。文件类型包括554个JavaScript脚本文件、523个SVG文件、316个CSS样式文件、137个Java源代码文件、123个PNG图片文件、90个TypeScript文件、89个GIF图片文件、44个HTML页面文件和36个MAP文件。该系统采用了SpringBoot、Apache Shiro、Mybatis Plus和Thymeleaf等技术栈实现,并附带权限管理功能,适合搭建博客、企业网站等。适合用于学习和实践JavaScript、CSS、Java、TypeScript和HTML技术,以及开发内容管理系统相关的系统。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/326bc6aa99bd4e068708ab91a88ba159_weixin_44087733.jpg!1)
沐知全栈开发
- 粉丝: 5137
- 资源: 5025
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 数据库课程设计on-model-for-netwo开发笔记
- linux常用命令大全mage-processing-m开发笔记
- mysql安装配置教程droid-m开发笔记
- PWMmodel-for-network-ids-ma开发笔记
- apache-doris-build-env-for-2.0.c
- apache-doris-build-env-for-2.0.b
- apache-doris-build-env-for-2.0.a
- 1719422999141832_lls-release_cqfw.mobileconfig
- 数据库课程设计processing-m开发笔记
- pycharm安装教程ention-model-for-开发笔记
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)