Handle date format with PHP

Asked

Viewed 30 times

-2

*I’ve looked at other topics, and I couldn’t figure it out. I have a form like text which receives dates, the user writes in the format dd/mm/yyyy, but when I debug the value returns in yyyy/mm/dd. I need to receive the value in the format dd/mm/yyyy, I tried several codes from here but I couldn’t.

<div class="form-group">
    <label for="example-date-input" class="form-control-label">Nascimento do PET (dd/mm/aaaa)</label>
    <input type="date" class="form-control" name="dataaniversario" id="example-date-input" maxlength="10" required>
</div>
  • You have to handle it in PHP when receiving or in Javascript before sending. <input type="date"> displays the date according to the OS location, but stores the data in ISO format. Something else <input type="date"> is not compatible with all browsers.

1 answer

0


In INPUT TYPE=DATE it is not possible, what you can do is use some datepicker in JQUERY or JS, in PHP it is possible when you receive the value, convert it with strtodate()

Browser other questions tagged

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