Display Php Date Formate AM PM (2024-03-13 01:52 PM)
Publish: 30 March 2024, 6:23 pm IST | Views: 179
<td><?php echo date("Y-m-d h:i:s A", strtotime($row["create_date"])); ?></td>
output is 2024-03-13 01:52:18 PM
<td><?php echo date("Y-m-d h:i A", strtotime($row["create_date"])); ?></td>
output is without second 2024-03-13 01:52 PM
<td>{$row['create_date']}</td> to Change AM and PM
<td>" . date('Y-m-d h:i:s A', strtotime($row['create_date'])) . "</td>
and Different Code Ans 2
while ($row = mysqli_fetch_assoc($result)) {
$create_date = date_create($row['create_date']);
$formatted_create_date = date_format($create_date, 'Y-m-d h:i:s A');
echo "<tr>
<td>{$row['profile_for']}</td>
<td><a href='user_info.php?username={$row['username']}'>{$row['username']}</a></td>
<td>{$row['first_name']}</td>
<td>{$formatted_create_date}</td>
</tr>";
}
echo "</table>";
Use This Code 3
echo "<td>" . date("d M Y", strtotime($row["create_date"])) . "</td>";
Create Date: <?php echo $row['create_date']; ?><br><br>
Change to
Create Date: <?php echo date('d M Y', strtotime($row['create_date'])); ?><br><br>
Categories: Uncategorized








