Convert java.util.Date to java.time.LocalDate

前端 未结 13 2435
温柔的废话
温柔的废话 2020-11-22 08:45

What is the best way to convert a java.util.Date object to the new JDK 8/JSR-310 java.time.LocalDate?

Date input = new Date();
Loca         


        
13条回答
  •  花落未央
    2020-11-22 09:44

    What's wrong with this 1 simple line?

    new LocalDateTime(new Date().getTime()).toLocalDate();
    

提交回复
热议问题