I’m building out a form on a hotel for room reservations. Currently, a user can select a check-in and checkout date. When the user selects a check-in or checkout date the format comes through in the URL as yyyy-mm-dd
and in the URL as examplesite.com/1234?datein=yyyy-mm-dd
. How can I get the date output to be formatted as mm/dd/yyyy
?
Currently, this is my input tag:
<input class="date_in" id="datein" placeholder="" value="" type="date" name="datein">
2
Answers
Thank you @Ronak Hapailya and @mmm for your help. I figured out a different workaround because the output couldn't be modified in the format the travel software needed if the field remained a type="date" field.
This is what I did. I changed the field to a type="text" and made the text field show a datepicker UI.
The new code for the input fields:
Jquery to make the text field appear as a datepicker field:
As you cant change the input type date output formate. So instead of this you can change date formate in php
like above sample code you can change date formate whatever you want.