
日期相关工具类
zhengTornado
这个作者很懒,什么都没留下…
展开
-
根据生日自动计算年龄
public static int getAge(Date birthDay) throws Exception { Calendar cal = Calendar.getInstance(); if (cal.before(birthDay)) { //出生日期晚于当前时间,无法计算 throw new IllegalArgumentException( "The birthDay is before Now原创 2021-12-29 10:24:12 · 485 阅读 · 0 评论 -
近一周、近一个月、近三个月、近半年、近一年时间段内日期显示
package org.jeecg.common.util;import cn.hutool.core.date.DateTime;import cn.hutool.core.date.DateUtil;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.Calendar;import java.util.Date;imp原创 2021-12-21 10:08:29 · 2168 阅读 · 0 评论 -
JAVA时间日期处理类,主要用来遍历两个日期之间的每一天
package org.jeecg.common.util;import java.text.DecimalFormat;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.Date;import java.util.List;/** * JAVA时间日期处理类,主要用来遍历两个日期之间的每一天 * * @autho原创 2021-11-03 00:44:16 · 360 阅读 · 0 评论 -
java获取指定年月的开始时间与结束时间
package org.jeecg.modules.lecoo.outModalPc.controller;import java.text.SimpleDateFormat;import java.time.*;import java.util.Date;public class Test4 { public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public s原创 2021-08-25 14:57:13 · 969 阅读 · 0 评论 -
java dateutils 比较全的时间工具类
import org.apache.commons.lang3.StringUtils;import org.joda.time.DateTime; import java.text.DateFormat;import java.text.ParseException;import java.text.SimpleDateFormat;import java.time.Insta...原创 2020-04-15 09:40:04 · 3465 阅读 · 0 评论 -
MySQL数据库中时间类型总结
Mysql中经常用来存储日期的数据类型有三种:Date、Datetime、Timestamp。Date数据类型:用来存储没有时间的日期。Mysql获取和显示这个类型的格式为“YYYY-MM-DD”。支持的时间范围为“1000-00-00”到“9999-12-31”。Datetime类型:存储既有日期又有时间的数据。存储和显示的格式为 “YYYY-MM-DD HH:MM:SS”。支持的时间范围是...原创 2020-04-15 14:17:39 · 279 阅读 · 0 评论 -
LocalDateTime使用详解
为啥Date遭嫌弃了一、我想新建一个表示"此刻"的日期,打印出来:java8中的 LocalDateTime这玩意的出现就是为了干掉之前 JDK版本中的 Date老哥代码: public static void main(String[] args) { LocalDateTime localDateTime=LocalDateTime.now(); ...原创 2020-03-13 15:06:02 · 1083 阅读 · 0 评论