ASP.NET MVC datetime culture issue when passing value back to controller

前端 未结 7 1340
既然无缘
既然无缘 2020-12-05 18:32

How can i tell my controller/model what kind of culture it should expect for parsing a datetime?

I was using some of this post to implement jquery d

7条回答
  •  再見小時候
    2020-12-05 19:13

    When submitting a date you should always try and submit it in the format "yyyy-MM-dd". This will allow for it to become culture independent.

    I normally have a hidden field which maintains the date in this format. This is relatively simple using jQuery UI's datepicker.

提交回复
热议问题