DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Subtracting Time

Hybrid View

  1. #1
    Bryan Guest

    Subtracting Time




    I was wondering how I would go about subtracting one
    long time from another long time and have the output
    be a long time format without the AM/PM behind it.
    Basically I am trying to create a time card that allows
    the user to click one button (TimeIn) and it will input the current time
    into a text box. Then the user clicks andother button (TimeOut)
    and it also inputs the current time into a separate text box.
    Third the user clicks another button to determine the amout of time
    elapsed between the two times entered in the TimeIn and TimeOut
    text boxes. This is where I run into problems.

    any suggestions?

    P.S. that is how I want it to be no other way.

  2. #2
    Dennis Nagel Guest

    Re: Subtracting Time


    Storing the date in a long will truncate the
    hours minutes seconds portion of the date.

    ? CLNG(NOW)
    36679

    ? CDBL(NOW)
    36679.6824421296

    ? format( CDATE( 36679.6824421296 ) ,"MM/DD/YYYY hh:nn:ss am/pm")
    06/02/2000 04:22:43 pm

    ? CDATE( 36679.6824421296 ) , CDATE( 36679.5824421296 )
    6/2/00 4:22:43 PM 6/2/00 1:58:43 PM
    (Time Out) (Time In)

    ? cdate( CDATE( 36679.6824421296 ) - CDATE( 36679.5824421296 ))
    2:24:00 AM

    Shows that he spent ~ 2.5 hours on the job.

    D.


    "Bryan" <bjs1117@ksu.edu> wrote:
    >
    >
    >
    >I was wondering how I would go about subtracting one
    >long time from another long time and have the output
    >be a long time format without the AM/PM behind it.
    >Basically I am trying to create a time card that allows
    >the user to click one button (TimeIn) and it will input the current time
    >into a text box. Then the user clicks andother button (TimeOut)
    >and it also inputs the current time into a separate text box.
    >Third the user clicks another button to determine the amout of time
    >elapsed between the two times entered in the TimeIn and TimeOut
    >text boxes. This is where I run into problems.
    >
    >any suggestions?
    >
    >P.S. that is how I want it to be no other way.



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