The time is stored in the database in the format of 11:00:00. I don’t need the output of a second, so I use the following on the output. function:

printf('<td>%s</td>', date('G:i',$myrow['time'])); 

But to any values ​​that lie in the database, displays 4:00 How to fix it? The type in the database is time.

  • Is it possible to simply convert a given time into text, and trim unnecessary characters with some function? - Radik Kamalov
  • @ Radik Kamalov, yes you can. - Oleg

1 answer 1

Read carefully what arguments the date function accepts.

  • Made a varchar type in the database, it still prints 4:00 - Radik Kamalov
  • In order for your code to work as it should, you need to change the field type to bigint , and the value of this field must have a date in the unix timestamp format. - Oleg