Calcs with Time


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Calcs with Time

  1. #1
    Jason West Guest

    Calcs with Time


    Greetings,

    I have two labels displaying two "Times", Program Running Time and Actual
    Processing Time. I want to do the following calculation with these times:

    varDownTime = lblProgramRunningTime.caption - lblAcualTime.caption

    where the captions hold the time displayed with the following format "hh:mm:ss".
    I have tried several different approaches but I keep ending up with 0 as
    a result. Any suggestions would be much appreciated.

    Regards,
    Jason "Stuck in Time"

  2. #2
    Dean Earley Guest

    Re: Calcs with Time

    It would be better to use the original values used to fill the labels, but if you want to do it this way:
    varDownTime = datediff("d", CDate(lblProgramRunningTime.caption), CDate(lblAcualTime.caption))
    That will give you the differnce in days, If you want hours, replace DateDiff("d" with DateDiff("h"

    --
    Dean Earley (dean.earley@icode.co.uk)
    Assistant Developer

    iCode Systems
    "Jason West" <jvwest@northstate.net> wrote in message news:3bb086af$1@news.devx.com...
    >
    > Greetings,
    >
    > I have two labels displaying two "Times", Program Running Time and Actual
    > Processing Time. I want to do the following calculation with these times:
    >
    > varDownTime = lblProgramRunningTime.caption - lblAcualTime.caption
    >
    > where the captions hold the time displayed with the following format "hh:mm:ss".
    > I have tried several different approaches but I keep ending up with 0 as
    > a result. Any suggestions would be much appreciated.
    >
    > Regards,
    > Jason "Stuck in Time"




  3. #3
    Jason West Guest

    Re: Calcs with Time


    Thanks Dean works great. Used datediff("s", to get seconds.

    Jason


    "Dean Earley" <dean.earley@icode.co.uk> wrote:
    >It would be better to use the original values used to fill the labels, but

    if you want
    >to do it this way:
    >varDownTime = datediff("d", CDate(lblProgramRunningTime.caption), CDate(lblAcualTime.caption))
    >That will give you the differnce in days, If you want hours, replace DateDiff("d"

    with
    >DateDiff("h"
    >
    >--
    >Dean Earley (dean.earley@icode.co.uk)
    >Assistant Developer
    >
    >iCode Systems
    >"Jason West" <jvwest@northstate.net> wrote in message news:3bb086af$1@news.devx.com...
    >>
    >> Greetings,
    >>
    >> I have two labels displaying two "Times", Program Running Time and Actual
    >> Processing Time. I want to do the following calculation with these times:
    >>
    >> varDownTime = lblProgramRunningTime.caption - lblAcualTime.caption
    >>
    >> where the captions hold the time displayed with the following format "hh:mm:ss".
    >> I have tried several different approaches but I keep ending up with 0

    as
    >> a result. Any suggestions would be much appreciated.
    >>
    >> Regards,
    >> Jason "Stuck in Time"

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center