homepage Welcome to WebmasterWorld Guest from 54.237.213.31
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
DateDiff function
jefferson

5+ Year Member



 
Msg#: 90 posted 8:18 pm on Oct 13, 2005 (gmt 0)

i am trying to subtract two dates in the format
1/1/2005 13:45. I am trying to pull all records between two dates that the difference between the TimeIn(1/1/2005 15:00) and the TimeOut(1/2/2005 20:00) fields are > 3 hrs. i am using Access.

 

SuzyUK

WebmasterWorld Senior Member suzyuk us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 90 posted 8:47 pm on Oct 13, 2005 (gmt 0)

Hi, don't know if this is any help, but I tried a DateDiff query on a table I have ..


SELECT *, TimeIn, TimeOut
FROM YourTable
WHERE ((DateDiff("h",[TimeIn],[TimeOut])>3));

the asterisk, would be replaced with the other fields you actually want if the asterisk is too much.. but I think you have to name your time in/out fields specifically.

Suzy

jefferson

5+ Year Member



 
Msg#: 90 posted 9:36 pm on Oct 13, 2005 (gmt 0)

Thanks suzy, that code worked perfectly

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved