【Util】 时间天数增加,时间比较。
生活随笔
收集整理的這篇文章主要介紹了
【Util】 时间天数增加,时间比较。
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
版權聲明:本文為博主原創文章,未經博主允許不得轉載。 https://blog.csdn.net/inforstack/article/details/46516623 public static void main(String[] args) {try {DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");Calendar calendar = Calendar.getInstance();calendar.setTime(new Date());calendar.add(Calendar.DATE,7);System.out.println(formatter.format(calendar.getTime()));Date createDate = formatter.parse("2015-06-25 07:07:21"); // 創建時間Date currentDate = formatter.parse("2015-06-25 07:07:22"); //當前時間System.out.println("創建時間在當前時間之前?" + createDate.before(currentDate));} catch (ParseException e) {e.printStackTrace();}
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎
總結
以上是生活随笔為你收集整理的【Util】 时间天数增加,时间比较。的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 消灭编译警告(Warning)
- 下一篇: 【SVM预测】基于蝙蝠算法改进SVM实现