Error in php’s date function?

Asked

Viewed 307 times

0

I have the following problem, my date field in the form is configured according to the code below

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

And I receive the same in the following variable $maturity and already use the class date() to convert and send to the database according to 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 $maturity is being 1969-31-12, I’ve used this function other times this way and it worked correctly, but now I’m with this error, have another way to work without being with replace? the databand is mysql in version 5.6 and php in version 5.6 hosting is remote. Thank you.

1 answer

0

Try:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.