I have a problem, i am building an account overview. And when someone enters his date format: 'MM-DD-YYYY' then it works. That value gets saved in the database and i load it again inside the input as value. But the weird thing is that when i load it. It loads as format: 'MM-DD-YYYY' with TIME.
Here come's my code:
THIS IS HTML WITH PHP
<input type='text' name='date' class='form-control datetimepicker-input' id='datetimepicker5' data-toggle='datetimepicker' data-target='#datetimepicker5' value='<?php echo $date ?>' autocomplete="off" />
THIS IS JQUERY
$('#datetimepicker5').datetimepicker({ viewMode: 'years', format: 'MM/DD/YYYY', useCurrent: false });
Can someone help me with this problem. I cant load the normal birth date now. Thanks for your time.
The input is just 08/23/2016 and the output when loading the date from the database in a variable it shows as 08/23/2016 12:00 AM. It also gets saved as 08/23/2016 in the database.
Inside inspection it also shows as this :
<input type="text" name="date" class="form-control datetimepicker-input" id="datetimepicker5" data-toggle="datetimepicker" data-target="#datetimepicker5" value="08/23/2016" autocomplete="off">
While the date field in the browser shows as 08/23/2016 12:00 AM
LAST EDIT FOR SOMEONE WHO IS SEARCHING HERE IS A WORKING ANSWER The answer below didn't work for me. But a quick and nice solution is putting inside the input data-date-format="MM/DD/YYYY"
.