Error in php date function? [duplicate]

0

I have the following problem, my date field in the form is configured as per the code below

<script>
jQuery(function ($) {
    $("#txtVencimento").mask('00/00/0000');        
});
</script>

And I get the same in the following variable $ expiration and I already use the date () class to convert and send to the database as per the code below

$vencimento =   date('Y-m-d', strtotime($_POST['txtVencimento']));

For example if you type the date 18/01/2017 in the input the output in the variable $ expiration is being 1969-31-12, I have used this function other times this way and it worked correctly, but now I have this error, another way of working without being with replace? the database is mysql in version 5.6 and php in version 5.6 the hosting is remote. Thank you.

    
asked by anonymous 18.01.2017 / 20:33

1 answer

0

Try:

$vencimento =   date('d-m-Y', strtotime($_POST['txtVencimento']));
    
18.01.2017 / 20:38