将小时和分钟分成15分钟

时间:2015-05-28 10:33:46

标签: php mysql

我的MySQL数据库中有两列 - //in each ViewController handle a UITableView - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{ NSLog(@"TableView touched") } } //in the ViewController handle the UIScrollView - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{ NSLog(@"ScrollView touched") } } //as a side note...I set three ViewControllers(each holds one TableView) into a ContainerViewController(holds ScrollView) hours

我希望能够使用PHP将值拆分为15分钟。

例如,如果我有一行是:

minutes

它将是hours = 1 minutes = 30

如果一行是

6 x 15 minutes

它将是hours = 2 minutes = 0

2 个答案:

答案 0 :(得分:2)

这应该返回多个15分钟的段

SELECT ROUND((hours*60+minutes)/15) AS segments FROM `table`

您还可以使用CEILFLOOR代替ROUND来实现非整数段的必要舍入。

答案 1 :(得分:0)

SELECT ROUND(TIME_TO_SEC('1:30:00')/900,0) x;
+------+
| x    |
+------+
|    6 |
+------+

SELECT ROUND(TIME_TO_SEC('2:00:00')/900,0) x;
+------+
| x    |
+------+
|    8 |
+------+
相关问题