Graphics

 View Only
  • 1.  CONVERTING NUMBER INTO TIME

    Posted 12-01-2022 03:52
    Hi, thru datalinq i am getting a number (total seconds)  which i want to convert into time format and output the same as HH:NN:SS. For example 6335 should be converted to 01:45:35. Want to achieve this thru VL only and not scripting. Any idea how to go about it?

    Thanks

    ------------------------------
    GAURAV SODHANI
    Freelancer
    ------------------------------


  • 2.  RE: CONVERTING NUMBER INTO TIME

    MalThePal
    Posted 12-01-2022 12:22
    This could be a fun one. I would start with the string length, maybe you can separate the various places and then encode them. I'm going to give it shot on my own and follow your progress. But I bet Red will have this for you before lunch.

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 3.  RE: CONVERTING NUMBER INTO TIME

    MalThePal
    Posted 12-02-2022 11:00
    This came to mind: in VL divide by 60 and you get minutes, divide minutes by 60 and you get hours. Take these values and 'encode' them in date time. Will that work for you?

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 4.  RE: CONVERTING NUMBER INTO TIME

    Posted 12-03-2022 02:00
    I too was thinking on the similar line Malcolm. Will revert back. Thanks  


    ------------------------------
    GAURAV SODHANI
    Freelancer
    ------------------------------



  • 5.  RE: CONVERTING NUMBER INTO TIME

    Posted 12-13-2022 03:41
      |   view attached
    Hi @Red
    This is in connection with my yesterday's post on VL STRING COMPARE ERROR and also an update on this topic of converting seconds into an animated time. I have been able to achieve what i intend to (almost). With some bugs of which i dont have a resolution. Perhaps you or someone esteemed in this group can guide me.
    The query that i posted subsequently on yesterday's post, LEFT/RIGHT/MIDDLE String converting the decimals into a whole number. If you see the Left String box at the top of the image, u will notice that 0.9997 is being converted to 1. Where as i require the exact sequence of number to pluck out digit before the decimal. Since String was not able to achieve this i used TRUNC, problem solved BUT why does the string convert the decimals into the whole number?

    Now as per my requirement of converting seconds into time, i have been able to achieve that with the above VL.

    1. Hour conversion: Divide the seconds with 3600 to get the seconds in hrs and then use only the digit before the decimals
    2. Minutes Conversion: If the seconds are more than 3600 (1hr) then subtract the seconds by 3600 if not then by 0 to get the remaining figure which is divided by 60 to get the balance minutes. Thru the Left String, pluck out the numbers before the decimals to get absolute minute figure
    3. Seconds Conversion: Same process as for the minutes BUT balance minutes after the decimal is multiplied by 60 since the conversion from minutes to seconds is in 1:100 ratio and we want the seconds in 1:60 ratio.
    4. All the hrs/mins/secs output is connected to Encode Date Time and the final output is connected to a blank text.

    Inorder to animate the time i have also used a quad which is animating on X axis from 0 to 60
    Seconds input value is multiplied by quad animation and then divided by 60 to get the seconds animation.

    I hope what i wrote above makes sense. I am also attaching the xpression file for better understanding.

    Thru the above VL any input between 0 to 7199 (seconds) is converted into hh:mm:ss format. And here lies the limitation which i cannot figure out how to find the solution to. If the seconds figure is more then 7199, my time becomes 00:00:00. I know where the problem lies but cannot find a solution. The problem is with the subtraction of seconds input with 3600.
    So any help or suggestion would be appriciated.

    Thanks​

    ------------------------------
    GAURAV SODHANI
    Freelancer
    ------------------------------

    Attachment(s)

    xpf
    CLOCK ANIMATION.xpf   17 KB 1 version


  • 6.  RE: CONVERTING NUMBER INTO TIME

    Ross Staff
    Posted 12-13-2022 04:52
    Have you tried using a format float block? 


    You can be as precise as you like


    or do custom formats


    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 7.  RE: CONVERTING NUMBER INTO TIME

    Posted 12-18-2022 08:32
    I would do it like this:


    ------------------------------
    Juha Koivisto
    ------------------------------



  • 8.  RE: CONVERTING NUMBER INTO TIME

    Ross Staff
    Posted 12-20-2022 06:01
    Yes this is better.

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------