In the Survival WordPress Plugin, the score table contains a Time field.
![](https://byteway.eu/wp-content/uploads/2024/04/image-1.png)
To display a time value in HTML, it’s essential to validate and format the data.
$t = (new DateTime($score->starttime))->format('H:i:s');
echo '<input type="time" name="starttime" id="starttime" value="'.$t.'">';
![](https://byteway.eu/wp-content/uploads/2024/04/image-3.png)
Alternative
To avoid conversion problems, it is also possible to fetch the value in such a way that it can be used immediately in HTML. In this case, we could have used the format statement in SQL.
![](https://byteway.eu/wp-content/uploads/2024/04/image-14.png)
Result:
![](https://byteway.eu/wp-content/uploads/2024/04/image-15.png)
Submit
Next step is to save the time value into WP, yet another time check is needed.
$t = (new DateTime($_POST['starttime']))->format('Y-m-d H:i:s');
Ensure that you enclose the $t value within quotes; otherwise, the time value will not be accepted.