javascript date to java.time.LocalDate

后端 未结 2 1207
小鲜肉
小鲜肉 2021-02-08 11:38

I\'m trying to post json data to a Controller in Java.

This is my controller:

@ResponseBody
    @RequestMapping(value=\"/{schoolId}\", method=RequestMeth         


        
相关标签:
2条回答
  • 2021-02-08 12:01

    Since you are using moment there is a simple way to achieve this :

    let startDate = moment().toISOString();
    

    This will convert to valid LocalDateTime format

    0 讨论(0)
  • 2021-02-08 12:07

    I got the same problem, solved it using:

    var dateString = new Date().toISOString().substring(0,10);
    

    or

    var dateString = new Date().toISOString().split("T")[0];
    

    Convert to ISO string ("2015-10-14T09:39:49.942Z"), then keep only first ten characters ie, the date.

    0 讨论(0)
提交回复
热议问题