-1

From my question,

Below is my code

 echo "<td>" . $row['StartTime'] . "</td>";

'StartTime' is a row in a database table that displays DATETIME format. Want to ask, how to display Date only at my PHP page?

Hawau
  • 99
  • 9

1 Answers1

2

Just need to use format function of php as shows

 echo "<td>" .$row['StartTime']->format('Y-m-d'). "</td>";

Hope it helps.

Go through the documentation also

https://www.php.net/manual/en/datetime.format.php.

As per the comments

 echo "<td>" .date('Y-m-d',strtotime($row['StartTime'])."</td>";;
Vimal
  • 1,140
  • 1
  • 12
  • 26