Skip to content
Advertisement

Is it possible to create a table with a hh:mm time column?

I want to create a table column that has a hh:mm format. How do I do that?

I’ve tried it with time(0) but that also gives me the seconds.

CREATE TABLE courseTimes (
  startingTime time(0),
  endingTime time(0)
);

I want the entries to look like

startingTime 19:25

endingTime 20:10

for example.

Advertisement

Answer

You can retrieve the time and format it like this.

Select
 TIME_FORMAT(startingTime),'%H:%i' ),
 TIME_FORMAT(endingTime),'%H:%i' )
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement