Ask Experts Questions for FREE Help !
Ask
    gwallace1's Avatar
    gwallace1 Posts: 25, Reputation: 1
    New Member
     
    #1

    Dec 24, 2008, 03:37 AM
    Time Calculation
    How do you get Access to add time when the time can span over two or meore days. I have a start date field, an End Date field as well as a start and end time field. For instance if I start on 01/01/2009 at 0600 and end on 01/02/2009 at 1800 I need access to tell me the sum is 32 hours... Any way to do this? Also where should this calculation take place if I want it to be a stored value? Thanks in advance.

    GW
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Dec 24, 2008, 07:53 AM

    First you need to understand how Access stores date/time values. Date/time values are stored as a double precision number where the integer portion is the number of days since 12/30/1899 and the decimal portion is a fraction of a day (ex: 6AM or 6 hrs = .25)

    So, if you need to do time arithmetic you need to store the date and time together. The second key is to use the Date Diff function and calculate time in terms of the precision you need. The Datediff function will calculate the time difference in terms of hours, minutes or seconds. Once you get the difference, you can then display the time as a text string. For example, assuming you get the difference in minutes, lets modify your example and say the time span goes from 1/1 0600 to 1/2 1830. This would total 1950 minutes. So you could use the expression:

    =Int(DateDiff("n",time1,time2)/60) & ":" & DateDiff("n",time1,time2) MOD 60
    This would display 32:30

    As a general rule we do not store calculated values, so you could use this exptression to display the difference wherever needed.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Tax calculation [ 2 Answers ]

I am working in Software Company and earning Rs. 3,70,000/- per annum. I have taken the Housing Loan for Rs. 8,25,000/-. I am paying the EMI Rs. 15000/- per month. I need tax calculation for this whether Let out or Let in the property. If I let out, what will happen? Or If let in, what will happen....

NJ Tax Calculation [ 8 Answers ]

This is the first question I would be asking in this community... I tried to go through some threads but didn't get the complete answer... I needed a clarification regarding the calculation of NJ state tax .It would be great if someone could help me out in this. As per my understanding on NJ...

Time calculation [ 2 Answers ]

Two trains are running at the same time facing each other between Distances of 100 kms. One train is traveling at 10kms per hour and another At 8kms per hour. Within how much time (rounded to Hrs and Minutes) both Trains will meet. A. 5 Hrs 34 Minutes B. 6 Hrs 4 Minutes C....


View more questions Search