472,146 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

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

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

Apr 1 '07 #1
1 2531
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
  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
reply views Thread by Saiars | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.