![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Date
Skr郎
看什么?6,你和我,走一波!
展开
-
1 String与Date互转
public class Test { public static void main(String[] args) { //String转Date String string = "2016-10-24 21:59:06"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ...原创 2019-08-01 14:23:52 · 97 阅读 · 0 评论 -
2 计算两个日期相差多少天
/** * 计算两个日期相差多少天 * * @param endDate 结束日期 eg:20190801 * @param beginDate 开始日期 eg:20191231 * @return 相差天数 */ public static String getDifferenceDays(String endDate, ...原创 2019-08-21 15:16:58 · 228 阅读 · 0 评论 -
3 获取指定日期的指定天数后日期
/** * 获取指定日期的指定天数后日期 * * @param date 指定日期 * @param days 指定天数 * @return 结果 */ public static String getDesignatedDate(String date, String days) { try { ...原创 2019-08-21 15:19:07 · 486 阅读 · 0 评论 -
4 时间字符串格式互转
/** * 中划线时间字符串格式化为 日期字符串(yyyyMMdd) * 其他格式,只需更改格式化即可 * * @param time 时间 * @return 格式化后时间 */ public static String midLineTimeFormatDate(String time) { try { ...原创 2019-08-21 15:22:14 · 116 阅读 · 0 评论 -
5 获取下个月第一天和最后一天
/** * 获取指定日期下个月的第一天 * * @param dateStr 当前时间 * @return 下个月第一天 */ public static String getFirstDayOfNextMonth(String dateStr) { SimpleDateFormat sdf = new SimpleDat...原创 2019-08-21 15:23:01 · 239 阅读 · 0 评论