使用Java8新特性LocalDateTime获取周几

package test;

import java.time.LocalDateTime;

public class Test {
    public static void main(String[] args){
        //获取当前时间
        LocalDateTime endDate = LocalDateTime.now();
        //获取当前周
        Integer week = endDate.getDayOfWeek().getValue();
        System.out.println("获取当前周:" + week);
    }
}

控制台执行结果:
Java8新特性LocalDateTime获取周几

相关文章:

  • 2021-08-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
  • 2021-07-24
相关资源
相似解决方案