asp.net mvc - How do I pass a date via the URL, for my Action to read in MVC? -


How do I pass a date via URL?

What I'm trying to do here, as you will see that is invalid in the URL which uses forward slash

  http: // localhost / controller / Action / id = 0d5375aa-6d43-42f1-91f0-ea73d9bb361 and date = 02/12/2009  

You can pass a date in the query string in a specific format, say yyyymmdd and then parse it correctly in your controller.

  and date = 02/12/2009 change and date = 200 9 yyyymmdd  

You can either cover a datetime around the datetime object Which could be made using this new format immediately or simply parse itself in the controller.

  public MyWrapperDate (int date) {int year = date / 10000; Int month = ((date - (10000 * year) / 100); Int day = (date - (10000 * year) - (100 * months)); This.DateTimeObject = New date time (year, month, day); }  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -