Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Diff between two dates/times

Status
Not open for further replies.

jmc014

Technical User
Nov 24, 2007
80
0
0
ES
Hi,

I'm wondering if someonce could help me with a problem that I've been working on for a while.
I have 4 fields [Start_Date], [Start_Time], [End_Date] and [End_Time]. I'd like to know how I can implement the datediff funtion to calculate the total time
(either days or hours) elapsed beteen these four fields.

Can anyone push me in the right direction.
Thanks.



 
hi,

simply [end date-time] minus [start date-time]

Duration = ( [End_Date] + [End_Time] ) - ( [Start_Date] + [Start_Time] )

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks skip,

I see where your going, the results in your code only showin the date diff, not the date & time diff.
I mean, the time factor is not being taken into consideration.

JMC,
 
Skip's expression will correctly return the duration down to the second. Formatting of the display may obfuscate the actual value. The result should be in "days" unit so 24 hours is 1.0. A day and a half is 1.5 is 36 hours.

Duane
Hook'D on Access
MS Access MVP
 
the time factor is not being taken into consideration

Huh? How did you arrive at that conclusion from the code that I posted?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top