Reputation: 13442
so I am using the input type="date" in my form and it shows mm/dd/yyyy and my current code in my form is <input type="date" value="<?= $row['bdate']; ?>">
and it still shows mm/dd/yyyy instead of a date like 10/01/1992. Is there a way to accomplish a thing like that?
Upvotes: 0
Views: 3112
Reputation: 588
The date should take the format YYYY-MM-DD. Single digit days and months should be padded with a 0. January is 01.
A string representing a date.
Value: A valid full-date as defined in [RFC 3339], with the additional qualification that the year component is four or more digits representing a number greater than 0.
<input type="date" value="2013-01-08">
Upvotes: 1
Reputation: 31749
Change the format while setting the value. Try with -
<input type="date" value="<?= date('d/m/Y', strtotime($row['bdate'])); ?>">
Or -
<input type="date" value="<?= date('d/m/Y', strtotime(str_replace("/", "-", $row['bdate']))); ?>">
Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.
Upvotes: 1