DateKit

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
日期操作工具类 /** * 将日期对象按照换为时间字符串 * 默认格式为"yyyy-MM-dd HH:mm:ss" * @param sourceTime * @return * @throws ParseException */ public static String formatDate(Date sourceDate) /** * 将日期对象按照指定格式转换为时间字符串 * @param sourceTime * @param formatStr * @return * @throws ParseException */ public static String formatDate(Date sourceDate, String formatStr) /** * 将时间字符串按照指定格式转换为时间字符串 * @param sourceTime * @param formatStr * @return * @throws ParseException */ public static String formatDate(String sourceTime, String formatStr) /** * 得到当前时间指定天数之前几天的日期 * @param days 指定的天数 * @return */ public static Date getFormerDateOfDays(int days) /** * 得到当前时间之前几个小时的日期 * @param hours 指定的小时数 * @return */ public static Date getFormerDateOfHours(int hours){} /** * 得到当前时间之前多少秒的日期 * @param sec 指定的秒数 * @return */ public static Date getFormerDateOfSecond(int sec){ } /** * 得到指定日期之前sec秒的日期 * @param days 指定的天数 * @return */ public static Date getFormerDateOfSecond(Date date, int sec){ } /** * 将时间字符串转换为日起对象 * 默认格式为“yyyy-MM-dd HH:mm:ss” * “yyyy/MM/dd HH:mm:ss”也可以 * @param sourceTime * @return * @throws ParseException */ public static Date paresDate(String sourceTime) throws ParseException { } /** * 返回指定月份的最后一天 * @param year * @param month * @return */ public static int getLastDayOfMonth(int year, int month){ } /** * 计算两个日期间的秒数 * @param beginDate * @param endDate * @return * @throws ParseException */ public static long getSecondBetweenDate(String beginDate, String endDate) throws ParseException { } /** * 将时间字符串按照指定格式转换为日期对象 * @param sourceTime * @param formatStr * @return * @throws ParseException */ public static Date paresDate(String sourceTime, String formatStr) throws ParseException { }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

处处清欢

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值