Reputation: 655
i have a field from my database which is start/end date sample fields is
sample field
start_date | end_date
2017-04-19 | 2017-04-23
what i want to do is to display this data to my:
<input type="date" name= "start_date" value="<?php echo $value['start_date']?>">
but what happen is it doesn't display anything... i tried to use
<input type="date" name= "start_date" value="<?php echo date('Y-m-d',strtotime($value["start_date"]))?>">
but it displays a different date which is not from my database.. any suggestion to display the date data from my db to the input type="date" ??
Upvotes: 4
Views: 12539
Reputation: 4904
strtotime
is use to format a local time/date according to locale settings
Try like this:-
<input type="date" class="m-wrap" value="<?php echo strftime('%Y-%m-%d',
strtotime($value['start_date'])); ?>" name="date" />
It will work for you .TO check about strtotime
look this
Upvotes: 4