469,934 Members | 1,743 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

how to convert the time which is in hh:mm:ss to just mm:ss

seshu
156 100+
Hi every body to morning my cousine has show his application and also his live db in that to sav the length of all the voice files he has saved in time format ie he took the datatype of time now i want to generate a an excell sheet of that table but here i want the time to be like mm:ss but not hh:mm:ss examle

the length of song sweet dreams is 01:12:35 now i want this to be shown as
72:35 how is there any procedure to convert directly in mysql or should i have to use a frontend code

regards
seshu
Apr 1 '07 #1
1 2411
ronverdonk
4,258 Expert 4TB
You can convert the hour part of the time string to minutes, add the minutes to it and concatenate with the seconds from the time string, as follows:
Expand|Select|Wrap|Line Numbers
  1. SELECT CONCAT(
  2.               SUBSTR(mytime,1,2)*60+SUBSTR(mytime,4,2),
  3.               ':',
  4.               SUBSTR(mytime,7,2)
  5.               ) 
  6.        AS TIME time_in_mins from test;
the result is a char string.

Ronald :cool:
Apr 1 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by hikums | last post: by
6 posts views Thread by Able | last post: by
2 posts views Thread by Robert Brown | last post: by
5 posts views Thread by kpp9c | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.