Click here to Skip to main content
15,886,078 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Just started working with MVC and i'm currently looking for the easiest way to create a DateTimePicker using MVC3.

Simply said this is what I'm looking for:
@Html.DateTimePickerFor(m => m.BirthDay)

Now I know this doesn't exist, but there should be something simular like this?

Willem
Posted
Updated 20-Sep-18 10:57am

See, if something like this helps you: JQueryUI Datepicker in ASP.NET MVC[^]

Few blogs discussing the same:
Date / Time Picker (ASP.NET MVC & jQuery) – Part 1[^]
ASP.Net MVC DatePicker[^]
 
Share this answer
 
how to use date time picker in mvc 3
 
Share this answer
 
If you want to use both date and time picker at the same time, the simple and easy way is to use jquery UI timepicker add-on, it works with exisitng jquery datepicker.

solution
<script src="jquery.min.js"></script>
<script src="jquery-ui.min.js"></script>
<script src="jquery-ui-timepicker-addon.js"></script>


After that call it
<script type="text/javascript">
 $(document).ready(function () {
    $("#date").datetimepicker({
         dateFormat: 'dd-mm-yy', timeFormat: 'hh:mm:ss' 
    });
 });
 </script>

 @Html.TextBoxFor(m => m.StartTime, new {id = "date"})
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900