Convert a duration varchar into minutes

  • Hi Guys n Gals

    I desperatley need your help. I have a field which gives the duration for a problem as 10h 51m. I need to convert it to show 651 as interger. Could someone please explain the best way to do this.

     

    Thanks in advance...

     

    Kal...

  • parse the string (looking for the indicaters as to where the h + m bits are) and use the numbers extracted in the formula (60*hnum) + mnum.

    you will need to locate the position of the h (if it exists)....and any number in the string 'located to the left' f the h should be assigned to the variable hnum.

    repeat for finding the m.

    take care that the mnum doesn't include the previous 'h'.

    if in difficulty...post your sample code for corrections....but do have a go!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply