0
$query = "SELECT horario FROM tempo WHERE teste = $teste";
Way it returns: 2019-07-26 19:24:17
Way I want it to return:19:24:17
0
$query = "SELECT horario FROM tempo WHERE teste = $teste";
Way it returns: 2019-07-26 19:24:17
Way I want it to return:19:24:17
1
You can use the function DATE_FORMAT
to display the data you want to date in any way you want:
SELECT DATE_FORMAT(colName,'%H:%i:%s') AS horario
FROM tempo
Formats the date value According to the format string.
In free translation:
Format date value according to format string.
0
You can also use as follows
SELECT TO_DATE(horario,'HH24:MI:SS') FROM tempo WHERE teste = $teste;
0
Postgresql SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 10:30:15'); //10 SELECT EXTRACT(MINUTE FROM TIMESTAMP '2001-02-16 10:30:15'); //30 SELECT EXTRACT(SECOND FROM TIMESTAMP '2001-02-16 10:30:15'); //15
Mysql SELECT TIME('2019-07-07 11:28:46'); //11:28:46
Browser other questions tagged mysql sql database
You are not signed in. Login or sign up in order to post.