I need your help to solve this problem that was presented to me. It consists in that I want to show only the first 10 digits of a data in a row of a record in MySQL.
Example:
last_session: 2019-12-14 02:44:03
But I want it to be like this:
last_session: 2019-12-14
This is my PHP code. I appreciate your responses.
<p class="tdc">Último inicio (US):
<?php
$idUsuario = $_SESSION['id_usuario'];
$resultados = mysqli_query($mysqli,"SELECT last_session FROM usuarios WHERE id = $idUsuario");
while($consul = mysqli_fetch_array($resultados)){
echo $consul['last_session'];
}
?>
All you need to do is use the function
DATE
to format the date output, i.e. remove only the hour:minutes:seconds part for selection purposes.So your query should look like this:
For this case:
Reference
DATE
functionHow about you try this: