Skip to content

Instantly share code, notes, and snippets.

@aziz-blr
Created January 26, 2017 09:08
Show Gist options
  • Save aziz-blr/b8ba3e7d6af0bc64f76c651778c44433 to your computer and use it in GitHub Desktop.
Save aziz-blr/b8ba3e7d6af0bc64f76c651778c44433 to your computer and use it in GitHub Desktop.
Bootstrap Date/Time Picker - Change Formate On Change Event
<!-- BOOTSTRAP DATE TIME PICKER -->
<script src="plugins/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript">
$(function () {
$('#meetingdatetime').datetimepicker({format: 'DD-MM-YYYY, h:m a'}).on('dp.change',function(e){
var formatedValue = e.date.format("YYYY-MM-DD HH:mm:ss");
$("#datetime").val(formatedValue);
});
});
</script>
<script>
$('#meetingdatetime').datepicker({
format: 'dd/mm/yyyy',
autoclose: true
}).on('changeDate', function (e) {
var formatedValue = e.format("yyyy-mm-dd");
$("#datetime").val(formatedValue);
}); // SET MYSQL DATE FORMATE IN HIDDEN FIELD
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment