First question here, so please forgive me if this seems obvious. I’m having a bit of an issue working with the ‘TIME’ datatype in my MySQL database and trying to find the best way to trim the leading zeros off the beginning of the time stamp.
To be more specific, I have a songs table in my database, and in that table I have a song_length column. This column uses the Time datatype, so the presentation is always hh:mm:ss.
If my song is only 3 minutes and 42 seconds (for example), I’m hoping to have it display as simply: 3:42, as opposed to 00:03:42. Is there a built in PHP function (perhaps similar to date()) to deal with something like this?
Split it into an array, then cast each part as an int
If I were you though, I’d store the time as an integer representing the number of seconds.