javascript date to java.time.LocalDate

后端 未结 2 1204
小鲜肉
小鲜肉 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: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.

提交回复
热议问题