I am new to PHP. I have a date string from a date-picker input field. But when I try to convert date string it into a date, I get an unexpected date.
Sample error:
- If input (
$datestamp
) contains24/01/2016
, then it becomes$date = '70/01/01
[error]
Here is the PHP code:
<?php
$datestring = (isset($_POST['datetimepicker1'])) ? $_POST['datetimepicker1'] : "not";
$date = date("y/d/m", strtotime($datestring));
echo $datestring;
echo var_dump($date);
?>
updates: here is my datepicker code
<script type="text/javascript">
$(function () {
$('#datetimepicker1').datetimepicker({format:"DD/MM/YYYY", useCurrent: false });
});
</script>
Please help me fix this. Is this a format problem? I need to insert the date into an Oracle database.