title: ASP.NET MVC 3 Custom Type Conversion
body: <p>Right now, I have a class defined as such:</p>
  
  <pre><code>public class Task
  {
      public Guid TaskId { get; set; }
      public string TaskName { get; set; }
  
      [DataType(DataType.Time)]
      [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = @"{0:hh\:mm}")]
      public TimeSpan? TimeRequired { get; set; }
  }
  </code></pre>
  
  <p>I would like to allow the user to also enter "2h" or "15m" for 2 hours or 15 minutes respectively.  Is there a way I can allow these types of custom inputs?  I was thinking of just creating a text box and then doing a custom check against that incoming value and cast it correctly to a TimeSpan.  I wasn't sure if there was some type of "CustomConverter" much like the "CustomValidator" attribute.</p>
  
  <p>Please let me know if anything is unclear.</p>
  
  <p>Thanks in advance!</p>