开发者

Passing DateTime into TryUpdateModel

开发者 https://www.devze.com 2023-02-24 10:51 出处:网络
One property of my model is DateTime. I\'m working with DateTime format \"d.M.yyyy H:mm\", i.e. day.month.year. When I pass date like 11.4.2011 (April 11th, 2011) into TryUpdateModel, it comes back as

One property of my model is DateTime. I'm working with DateTime format "d.M.yyyy H:mm", i.e. day.month.year. When I pass date like 11.4.2011 (April 11th, 2011) into TryUpdateModel, it comes back as 4.11.2011, i.e. day and month swaps. Is there any way how can I instruct TryUpdateModel to parse datetime value the w开发者_如何学Pythonay I want, not the way system wants?

Thanks,

Antonin


I had the same problem and I discovered that if I use HTTPPost instead of HTTPGet MVC behaves as expected. I don't know why it solves the problem and I am still looking for the full answer to this question.

0

精彩评论

暂无评论...
验证码 换一张
取 消