2013年9月11日星期三

MySql database , to get two times the time difference , the results in minutes

Issues such as the title .
Let me share with you three on the processing time difference :


两日期/时间之间相差的天数:     
SELECT  To_Days(end_time) - To_Days(start_time);

两日期/时间之间相差的时分秒数:     
SELECT  SEC_TO_TIME(UNIX_TIMESTAMP(end_time) - UNIX_TIMESTAMP(start_time));

两日期/时间之间相差的秒数:     
SELECT  UNIX_TIMESTAMP(end_time) - UNIX_TIMESTAMP(start_time);

------ Solution ------------------------------------- -------
SQL does not understand , Bangding . The best region in SQL I asked .
------ Solution ---------------------------------------- ----
difference can be calculated from the number of seconds that you want to get the number of minutes to seconds divided by 60 is not on the line ah ? Or I got it wrong ?
------ For reference only -------------------------------------- -
once in sql region inside asked , did not care , I feel the majority of irrigation , so every time to the J2EE ask, huh
------ For reference only ------ ---------------------------------
top about
------ For reference only ---------------------------------------

I need sql statement time data in the database will be converted to minutes , also considered other methods , but the former is still relatively good
------ For reference only ---------- -----------------------------
top

没有评论:

发表评论