My Station is configured to EU Location format for date: dd/mm/yyyy
Everything is working fine expect when I send a date as a parameter via HTTP get:
http://localhost:6105/assignment?date=07/02/2011
This call is received by this code:
public ActionResult Index(DateTime? date = null)
{
}
as date = 2.7.2011
any other date reference in the site is working OK and as expected (dd/mm/yyyy).
How can I resolve this ?
I had the same issue as you and found the solution at this site: Localization of dates in asp.net. The issue is that MVC does not support localization of DateTimes in GET-requests, only in POST-requests. This is by design!
The blog post mentions some javascript-hacks to avoid this issue but I’d change to use culture-invariant dates.