我在mysql中時間的格式爲HH:MM:SS 我如何可以轉換到12小時的時間,也拆除秒,因爲他們都是00如何轉換MySQL的時間
例如:
14:30:00
MySQL的
$finalresult = mysql_query("SELECT * FROM events WHERE clubID IN (" . implode(',', $clubIDs) . ") ORDER BY date ASC, TIME(startTime) ASC");
while($finalrow = mysql_fetch_assoc($finalresult)) {
$originaltime = $finalrow['startTime'];
$newtime = TIME_FORMAT($originaltime, '%h:%i %p');
}
這實際上是一個基本問題。 http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html – woz
這可能會幫助你找到你要找的東西http://stackoverflow.com/questions/13616672/如何將時間轉換爲十進制in-sql-with-an-integer –