SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Oct 2000
    Location
    San Francisco
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Converting minutes to seconds

    Hello,
    I would like to get a hint at how to convert the minute string such as "1:34:069" into a "94.069" seconds string by using Silk.

    thanks in advance
    Ringr10


  2. #2
    Senior Member
    Join Date
    Jun 1999
    Location
    Fremont, CA, USA
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Converting minutes to seconds

    Below is some code to get you started. I don't think it is exatly what you want, but it might work as a starting point.

    ------------------
    David Genrich
    david@e2Open.com
    david_kim@usa.net

  3. #3
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Converting minutes to seconds

    Here is the function I use:

    [+] STRING ConvertMinToSec(STRING sTime) //Modifies the minute:second.miliseconds fomat to seconds.milliseconds
    [ ] //************************************************** *************************************
    [ ] //* This function converts the format Minutes:Seconds.Miiliseconds (3:15.222) to seconds
    [ ] //* (195.222). In this format the value can be saved as a numeric.
    [ ] //* This function requires:
    [ ] //* STRING for a returned value
    [ ] //* STRING sTime for the original value
    [ ] //************************************************** **************************************
    [ ] INTEGER iPos
    [ ] STRING sTPart
    [ ] NUMBER nTPart
    [ ] INTEGER iLen
    [ ] NUMBER nSPart
    [ ] STRING sNTime
    [ ]
    [ ] iPos = StrPos (":", sTime) //Find the position of :
    [+] if iPos != 0 //If there is a : in the string
    [ ] sTPart = Left(sTime, (iPos - 1)) //Set the minutes to sTPart
    [ ] iLen = Len(sTime) //Get the length of sTime
    [ ] sTime = Right (sTime, (iLen - iPos)) //Cut the minutes and the : from the front of the original line
    [ ]
    [ ] nTPart = Val(sTPart) //Get the value of the minute string
    [ ] nTPart = nTPart * 60 //Multiply the minutes by 60 (to get total seconds)
    [ ]
    [ ] iPos = StrPos (".", sTime) //Get the position of the period
    [ ] sTPart = Left(sTime, (iPos - 1)) //Set sTPart to the seconds in the original string
    [ ] iLen = Len(sTime) //Get the legth of sTime
    [ ] sTime = Right (sTime, (iPos + 1)) //Cut off the seconds, but not the period
    [ ]
    [ ] nSPart = Val(sTPart) //Get the value of the seconds
    [ ] nTPart = nTPart + nSPart //Add the converted minutes value to the seconds value
    [ ] sTPart = Str(nTPart) //Get the string equivilent of the total seconds
    [ ] sNTime = sTPart + sTime //Concatenate the new string with the milliseconds
    [+] else //If there are no :'s in the string
    [ ] sNTime = sTime //Set sNTime = to the passed in time
    [ ]
    [ ] return sNTime //Return the new time string
    [ ]

    MikeF

    ------------------


    [This message has been edited by MikeF (edited 10-22-2001).]

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:00 AM.

Copyright BetaSoft Inc.