![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
time
GideonYeung
这个作者很懒,什么都没留下…
展开
-
java8 LocalDate获取当前时间在年的第几周
//第一个参数是周的开始,这里是周一开始;//第二个参数是一周最少几天//例如我这个参数是5,如果年的开始第一天是周4。那么这一周就只有4天就不满足,所以下面的值得到是16周就会少一周。LocalDate today = LocalDate.parse("2021-04-21");WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY, 5);int weekOfYear = today.get(weekFields.weekOfYear())原创 2021-04-21 16:59:24 · 4669 阅读 · 1 评论 -
LocaDateTime,LocalDate,localTime作为Spring MVC的参数,在controller层初始化。
@InitBinder protected void initBinder(WebDataBinder binder) { binder.registerCustomEditor(LocalDate.class, new PropertyEditorSupport() { @Override public void setAsText(String text) throws IllegalArgumentException {...原创 2021-03-09 15:13:28 · 403 阅读 · 0 评论 -
使用LocalDateTime的until方法计算相差的天,时,分,秒
public static void main(String[] args) throws InterruptedException { LocalDateTime offWorkTime = LocalDateTime.now().withHour(17).withMinute(30).withSecond(0); for (; ; ) { Thread.sleep(1000); LocalDateTime curre...原创 2021-03-08 17:35:05 · 2718 阅读 · 0 评论