I'm trying to display Time in my HTML Input Type Time with AM/PM but it seems that my code is not displaying in the Input Type.
Here's my output for HTML Input Time.
9:00 AM
But my HTML Input Type Time is still
--:-- --
Here's my Code.
<?php
//set up mysql connection
mysql_connect("localhost", "root", "") or die(mysql_error());
//select database
mysql_select_db("db") or die(mysql_error());
//select all records form tblmember table
$query = 'SELECT * FROM newsfeed';
//execute the query using mysql_query
$result = mysql_query($query);
//then using while loop, it will display all the records inside the table
while ($row = mysql_fetch_array($result)) { ?>
<div class="modal fade" id="myModal<?php echo $row['id'] ?>" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Admin</h4>
</div>
<div class="modal-body">
<form id="updateform" action="admin_update.php" method="post">
<fieldset>
<!-- image-preview-filename input [CUT FROM HERE]-->
<div class="form-group">
<img src="<?php echo $row['image'] ?>" class="img-responsive" />
</div>
<div class="form-group">
<label>When</label>
<br/>
<input type="time" class="form-control" value="<?php $date = date("h:i A", strtotime($row['time_d'])); echo "$date"; ?>" id="until_t" name="until_t" />
<br/>
</div>
<div class="modal-footer">
<input type="submit" id="btnsave" name="btnsave" class="btn btn-default" value="Save" />
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<?php } ?>
type="time"inputs have to use a valid RFC3339 timev alue. you're not providing that, so you get the default---stuff. trydate('H:i:s')instead.am/pmare not valid in this context.