My Model Class looks like this:
[DataType(DataType.Time)]
public DateTime Time {get; set;}
When I run it, I have a cool an HTML 5 Input Type in Time. When I save the data, the value in my database looks like this:
7/11/2014 1:00AM
It automatically saves the current date. I just wanna have the time saved. I'm trying to create a reservation system.
[DataType(DataType.Time)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm}")]
public DateTime Hour { get; set; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With