How to make time_to_minute in mysql?

How to make time in time_to_minute unit? (same as time_to_sec)

mysql> select time_to_min('00:00:1'); ERROR 1305 (42000): FUNCTION web145-mydb.time_to_min does not exist mysql> select time_to_minute('00:00:1'); ERROR 1305 (42000): FUNCTION web145-mydb.time_to_minute does not exist 
+6
source share
2 answers

Seems pretty simple:

 SELECT TIME_TO_SEC('00:00:1') / 60 
+19
source
 mysql> SELECT TIMESTAMPDIFF(MINUTE,'2003-02-01','2003-05-01 12:05:55'); -> 128885 

Source: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_timestampdiff

+3
source

Source: https://habr.com/ru/post/900216/


All Articles