Hi,
I am trying to create a parking app in MVC 4.
To register a car parking on a parking lot I need to have a field where I can set time and date marking the start of parking.
Right now I have a model with data annotations:
[Display(Name = "Parking Start Time")]
[DataType(DataType.Date), DisplayFormat(DataFormatString = "{0:HH:mm dd/MM/yyyy}", ApplyFormatInEditMode = true)]
public DateTime ParkingStartTime { get; set; }
And in View:
<div class="editor-label">
@Html.LabelFor(vm => vm.newCarOnParkingSpot.ParkingStartTime)
</div>
<div class="editor-field">
@Html.EditorFor(vm => vm.newCarOnParkingSpot.ParkingStartTime)
@Html.ValidationMessageFor(vm => vm.newCarOnParkingSpot.ParkingStartTime)
</div>
This gives me neat resault for date picking, but no time entering option:
Image
The reason I use formating is because the original DateTime format(US) does not suit my application. I would like to have it as close to - HH:mm dd/MM/yyyy - as I can.
What options do I have for getting date and also time from the user?
I have searched for solutions but somehow missed similar problems. Maybe I'm approching this problem from a wrong angle. Please be gentle, it's my first question.
Thank you in advance!