Reputation: 613
Undesirable output Desired display
Cannot set DB value for type = "time"
What is stored in the DB is 2:20
I want 2:20 on the edit screen
But as the picture comes out on the screen
How can I set the DB time to ?
edit.blade.php
<input id="estimated_work_time" type="time" name="estimated_work_time">{{$param->estimated_work_time}}
But I didn't get the results I wanted
edit.blade.php
<label for="estimated_work_time">Estimated work time</label><br>
<input id="estimated_work_time" type="time" name="estimated_work_time" value="{{$param->estimated_work_time}}"><br>
What should I do other than value?
It is displayed on the source code
I tried this too, but I get this error
<input id="estimated_work_time" type="time" name="estimated_work_time">{!!date('h:i a',strtotime($param->estimated_work_time)) !!} <br>
The error was this
A non well formed numeric value encountered
Upvotes: 1
Views: 118
Reputation: 3274
Alright here is what I've gathered,
Left side is chrome and in right side is Mozilla
In both the cases you simply needs to pass the value to the input by default,so i think you can achieve your desired output just by placing value like this XX:XX | 02:30.
<input id="estimated_work_time" type="time" name="estimated_work_time" value="{{ date('h:i',strtotime($param->estimated_work_time)) }}">
Here is the test i make it to understand it better
<?php
// If i run this
echo date('h:i','2:30');
// I will get this error PHP Notice: A non well formed numeric value encountered
// So first you need to convert your date or time string into the proper format
echo date('h:i',strtotime('2:30'));
// this will return output this : 02:30
?>
Upvotes: 1
Reputation: 542
for type time value should be 2:35 AM if you want 2:20 use other type and some php script
Upvotes: 0