<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                [TOC] # 方法 ![](https://box.kancloud.cn/ad4796c0f337a52e73522c5bb8465150_921x656.png) # 獲取當前時間 ~~~ LocalDate localDate = LocalDate.now(); LocalTime localTime = LocalTime.now(); LocalDateTime localDateTime = LocalDateTime.now(); //當前的年月日 System.out.println(localDate); //當前的時分秒 System.out.println(localTime); //當前的年月日加時分秒 System.out.println(localDateTime); ~~~ 輸出 ~~~ 2018-06-06 14:43:04.889017 2018-06-06T14:43:04.889065 ~~~ # of指定時間 ~~~ LocalDate of1 = LocalDate.of(2017, 8, 5); System.out.println(of1); LocalTime of2 = LocalTime.of(5, 11, 20); System.out.println(of2); LocalDateTime of3 = LocalDateTime.of(2017, 8, 5, 11, 11, 23); System.out.println(of3); ~~~ 輸出 ~~~ 2017-08-05 05:11:20 2017-08-05T11:11:23 ~~~ # getXxx獲取值 ~~~ LocalDateTime localDateTime = LocalDateTime.now(); System.out.println(localDateTime); //getXxx //年份的天數 System.out.println(localDateTime.getDayOfYear()); //月份的天數 System.out.println(localDateTime.getDayOfMonth()); //返回星期幾,英文 System.out.println(localDateTime.getDayOfWeek()); //返回月份,因為 System.out.println(localDateTime.getMonth()); //月份 System.out.println(localDateTime.getMonthValue()); //小時 System.out.println(localDateTime.getHour()); //分鐘 System.out.println(localDateTime.getMinute()); ~~~ 輸出 ~~~ 2018-06-06T14:54:02.650016 157 6 WEDNESDAY JUNE 6 14 54 ~~~ # withXxx修改時間 修改了后會返回新的對象,老的對象不變 體系了日期對象的不可變性 ~~~ LocalDateTime localDateTime = LocalDateTime.now(); System.out.println(localDateTime); //修改月份 LocalDateTime localDateTime1 = localDateTime.withDayOfMonth(20); System.out.println(localDateTime1); //修改小時 System.out.println(localDateTime.withHour(12)); ~~~ 輸出 ~~~ 2018-06-06T15:01:43.102993 2018-06-20T15:01:43.102993 2018-06-06T12:01:43.102993 ~~~ # plus添加時間 ~~~ LocalDateTime localDateTime = LocalDateTime.now(); System.out.println(localDateTime); //向前添加3天 LocalDateTime localDateTime1 = localDateTime.plusDays(3); System.out.println(localDateTime1); //向前添加2小時 System.out.println(localDateTime.plusHours(2)); ~~~ 輸出 ~~~ 2018-06-06T15:10:56.921629 2018-06-09T15:10:56.921629 2018-06-06T17:10:56.921629 ~~~ # minus減去時間 ~~~ LocalDateTime localDateTime = LocalDateTime.now(); System.out.println(localDateTime); //減去2天 System.out.println(localDateTime.minusDays(2)); //減去3小時 System.out.println(localDateTime.minusHours(3)); ~~~ 輸出 ~~~ 2018-06-06T15:12:25.612975 2018-06-04T15:12:25.612975 2018-06-06T12:12:25.612975 ~~~ # 判斷時間是不是在之前或者之后 ~~~ LocalDateTime localDateTime = LocalDateTime.now(); //加2天 LocalDateTime localDateTime1 = localDateTime.plusDays(2); //看時間在不在前面 boolean before = localDateTime1.isBefore(localDateTime); //看時間在不在后面 boolean after = localDateTime1.isAfter(localDateTime); //看時間是不是一樣 boolean equal = localDateTime1.isEqual(localDateTime); System.out.println(before); System.out.println(after); System.out.println(equal); ~~~ 輸出 ~~~ false true false ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看