title: jquery datetime picker datetime format issue with MVC3
body: <p>I'm using JQuery Date Time Picker in a MVC3 Application.I use date time to filter result for a list.following is how my search URL looks like </p>
  
  <p><code>/Objectives?Description=&amp;FromDate=03%2F10%2F2011</code></p>
  
  <p>the selected datetime format is 03 October 2011.</p>
  
  <p>but when it resolved in the controller it is taken as 10 march 2011.</p>
  
  <p>selected culture is <code>en-GB</code>.</p>
  
  <p>but when it used in a ajax form this issue does not exist because Ajax URL is automatically set as 
  <code>/Objectives?Description=&amp;FromDate=10%2F03%2F2011</code></p>
  
  <p>I use following lines of code to format the date time in the DateTimePicker.</p>
  
  <pre><code>$(function () {
      $(".datePicker").datepicker({ 
              changeMonth: true,
              changeYear: true,
              dateFormat: 'dd/mm/yy',
              altField: 'dd-mm-yy', 
              altFormat: 'dd/mm/yy' 
  
      });
  });
  </code></pre>
  
  <p>following is the code of the editor for the DateTime </p>
  
  <pre><code>@model DateTime?
  @{
      var htmlAttributes = new Dictionary&lt;string, Object&gt;();
      htmlAttributes.Add("class", "datePicker");
      htmlAttributes.Add("readonly", "true"); 
  }
  @Html.TextBox(string.Empty, (Model.HasValue ? Model.Value.ToString() : string.Empty), htmlAttributes)
  </code></pre>
  
  <p>we use the following model to get data from the user.</p>
  
  <pre><code>public class LogModel : LogBaseModel
  {
  
      [Display(Name = "From Date")]
          public DateTime? FromDate { get; set; }
  
          [Display(Name = "To Date")]
          public DateTime? ToDate { get; set; }
  
  }
  </code></pre>
  
  <p>following is the code in the index.cshtml</p>
  
  <pre><code>@using (Html.BeginForm("Index", "Calls", Model, FormMethod.Get))
  {
  &lt;div id="filter_set_wrapper"&gt;
                      @Html.Custom().FilterLabelFor(model =&gt; model.FromDate)
                      @Html.Custom().TextBoxFor(model =&gt; model.FromDate)
                      @Ajax.TextBoxClear("FromDate", "FromDateClear(#FromDate#, ##);", "Clear From Date", "PopUpLink.PNG")
                  &lt;/div&gt;
                  &lt;div id="filter_set_wrapper"&gt;
                      @Html.Custom().FilterLabelFor(model =&gt; model.ToDate)
                      @Html.Custom().TextBoxFor(model =&gt; model.ToDate)
                      @Ajax.TextBoxClear("ToDate", "ToDateClear(#ToDate#, ##);", "Clear To Date", "PopUpLink.PNG")
                  &lt;/div&gt;
  
  &lt;input type="submit" class="btn" value="Filter" /&gt;
  }
  </code></pre>
  
  <p>following is the controller method</p>
  
  <pre><code>public ActionResult Index(LogModel callsModel)
          {
              if (callsModel.FromDate != null)
              {
                  var model = callsModel;
  
                  var d = DateTime.Parse(model.FromDate.Value.ToString("MM/dd/yyyy"));
  
  
  
              }
  }
  </code></pre>
  
  <p>could anybody help me in resolving this question.The First answer is giving the correct date time.But the problem is when used with the model mentioned above could not get the correct date to the controller method.If anybody know how to fix it with above mentioned model please reply.</p>
  
  <p>Thanks in advanced.</p>