I'm using this nifty little date and time picker [ http://trentrichardson.com/examples/timepicker/ ]. How can I set the date and time for when the picker opens?
It Seems simple. $('#startdatetime-from'). datetimepicker({ language: 'en', format: 'yyyy-MM-dd hh:mm' });
Click the Date Picker Control in the Controls group. Click Properties in the Controls group. Click inside the Title text box and enter End Date:. In the Display The Date Like This list box, select the desired date format and then click OK.
To change the way that the date is displayed, double-click the date picker, click the Data tab, and then click the Format button. Choose a display format in the Date Format dialog box.
If you're using this on a form, set it from a hidden input.
$(document).ready(function () {
$("#Date").datetimepicker({
ampm: true
});
var date = new Date(
Date.parse(
$('#DatePicker').val(),
"mm/dd/yyyy hh:MM tt"
)
);
$('#Date').datetimepicker('setDate', date);
});
HTML Form:
<input type="hidden" id="DatePicker" />
<input type="text" id="DatePicker" value="fromyourdatabase" />
Try this
Then add$('#dtpkr').datetimepicker();
This will give you the current date and time$('#dtpkr').datetimepicker('setDate', (new Date()));
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