# Thread: date/time field calculation (Access 2000)

1. ## date/time field calculation (Access 2000)

Trying to figure out how to calculate number of hours have passed between two fields.
The fields contain both date and time. The field data looks like this: 4/21/02 10:03:21 AM

2. ## Re: date/time field calculation (Access 2000)

Date/time values are stored as number, with the integer part representing the number of days since 12/30/1899. The fractional part represents time since Midnight.
So if you subtract two date fields, the result is the number of days between them. To convert to hours, multiply by 24.
Example:
StartTime is 4/21/02 10:00 AM
EndTime is 4/21/02 7:00PM
EndTime - StartTime = 0.375
(EndTime - StartTime) * 24 = 9, i.e. the number of hours between the times.

You can also use the DateDiff function:
DateDiff("h";[StartTime];[EndTime])

3. ## Re: date/time field calculation (Access 2000)

You didn't say if you wanted the result in whole hours or not. If so, you can use the DateDiff function.

#### Posting Permissions

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