title: ModelState is invalid with DateTimeOffset + MVC4
body: <p>I have an issue with model state with datetimeoffset.
  Saw the answers at :<a href="https://stackoverflow.com/questions/15838760/modelstate-always-throws-invalid-datetime-error">Modelstate always throws invalid datetime error</a> but these doesnt solve my problem.</p>
  
  <p>I have FromDate in model:</p>
  
  <pre><code>[Required, Display(Name = "From")]
  [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
  public System.DateTimeOffset FromDate { get; set; }
  </code></pre>
  
  <p>I am showing it in my view:</p>
  
  <pre><code>&lt;div class="editor-label"&gt;
  @Html.LabelFor(O =&gt; O.FromDate)
  </code></pre>
  
  <p>-- start-- input data-val="true" id="FromDate" name="FromDate" type="datetime" class="datetime"      data-datetime="" value ="@Model.FromDate.ToString("r")" ---end</p>
  
  <pre><code>@Html.ValidationMessageFor(O =&gt; O.FromDate)
  &lt;/div&gt;
  </code></pre>
  
  <p>Changing the datetime value in jquery to local time in jquery:</p>
  
  <pre><code>if ($(this.element).val() != "") {
              // If we wont specify time on recreate then time sliders will stay unchanged.
              //  we manipulate datepicker value and value of input to display differently.
              //  LLLL--&gt; Thursday, April 18 2013 1:20 PM
              //  L --&gt; 04/18/2013
              //  LT --&gt; 8:30 PM
             this._Input.datepicker("setDate", new Date(moment($(this.element).val()).format("LLLL")));
             this._Input.val(moment($(this.element).val()).format("L LT"));
          }
  </code></pre>
  
  <p>However when I edit and save, I am getting "FromDate is not valid" exception.</p>
  
  <p>"The value 'Fri Jun 14 05:30:00 UTC+0530 2013' is not valid for From."</p>
  
  <p>can somebody pls advise how to solve?</p>
  
  <p>Model Binder:</p>
  
  <pre><code>protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType)
      {
          //var displayFormat = bindingContext.ModelMetadata.DisplayFormatString;
  
          string s = bindingContext.ValueProvider.GetValue("FromDate").AttemptedValue;
          string value = bindingContext.ValueProvider.GetValue("ThruDate").AttemptedValue;
          DateTimeOffset from;
          DateTimeOffset thru;
          if (s.IndexOf("UTC") != -1)
          {
                from = DateTimeOffset.ParseExact(s, "ddd MMM dd HH:mm:ss \"UTC\"zzz yyyy", CultureInfo.InvariantCulture);
          }
          else
          {
              from = DateTimeOffset.ParseExact(s, "ddd, dd MMM yyyy HH:mm:ss \"GMT\"", CultureInfo.InvariantCulture);
  
          }
  
          if (value.IndexOf("UTC") != -1)
              thru = DateTimeOffset.ParseExact(value, "ddd MMM dd HH:mm:ss \"UTC\"zzz yyyy", CultureInfo.InvariantCulture);
          else
              thru = DateTimeOffset.ParseExact(value, "ddd MMM dd yyyy HH:mm:ss \"GMT\"zzz \"(India Standard Time)\"", CultureInfo.InvariantCulture);
  
  
  
          return PrFactory.Create(Convert.ToInt32(bindingContext.ValueProvider.GetValue("PartyRoleTypeId").AttemptedValue),
              Convert.ToInt32(bindingContext.ValueProvider.GetValue("PartyId").AttemptedValue),
              from,
              Convert.ToBoolean(bindingContext.ValueProvider.GetValue("IsSoftDeleted").AttemptedValue),
              new Party(),
              new PartyRoleType(),
             thru);
  
          //return base.CreateModel(controllerContext, bindingContext, modelType);
      }
  </code></pre>