Timespan not accepting day in MVC3
- by middelpat
I have a MVC3 application in which i want to set a timespan to for example 2 days and 5 hours.
when i enter 02:05:00:00 it gives me the following exception:
System.OverflowException: SqlDbType.Time overflow. Value '2.05:00:00' is out of range. Must be between 00:00:00.0000000 and 23:59:59.9999999.
When i enter 05:00:00 it correctly saves 5 hours into the database. according to MSDN timespan has a property for days. How do i correctly set the days?
Model:
public class ProductionTimeVM
{
[Required]
public TimeSpan DefaultTime { get; set; }
}
In my view i just use:
@Html.TextBoxFor(x => x.DefaultTime)
For my controller:
public ActionResult SaveProductionTime(ProductionTimeVM vm)
{
ProductionTime productionTime = new ProductionTime();
productionTime.Default = vm.DefaultTime;
//some more code
}
Any idea's?