Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 13th, 2006, 10:37 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Difference between 2 dates

Hello!

I've never programmed in MS ACCESS so...

I have 2 cols with two dates and I'd like the difference between them in days.
How can I do this?

Thanx

Reply With Quote
  #2 (permalink)  
Old July 13th, 2006, 10:47 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You will need to assign the answer to a variable or a textbox or something, but for the function

result = DateDiff("d", Date1, Date2)

The "d" gives the result in days, but you can also do seconds, minutes.... even years.

HTH

Mike

Mike
EchoVue.com
Reply With Quote
  #3 (permalink)  
Old July 13th, 2006, 10:58 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx for fast reply.

" You will need to assign the answer to a variable or a textbox or something, but for the function"

I'm really DUM! I don't eaven know how to this.
Could u show me how to step by step??

I'd apreciate....

Reply With Quote
  #4 (permalink)  
Old July 13th, 2006, 01:47 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Naperville, IL, USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can also use the function in a query:

Code:
SELECT date1, date2, DATEDIFF("d", date1, date2) AS NumOfDays FROM SourceTable


Rand
Reply With Quote
  #5 (permalink)  
Old July 14th, 2006, 02:49 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

But is it possible to put it in the table? How?

Or just in a query or report?

Reply With Quote
  #6 (permalink)  
Old July 14th, 2006, 03:45 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK I made it!!!

Used the query.

Thanx a lot for both replies.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
get date difference between two dates in perl crmpicco Perl 12 June 7th, 2007 04:57 AM
Urgent! how to calculate difference between dates Subuana Beginning VB 6 2 March 22nd, 2006 05:34 PM
Difference in Dates mcinar Javascript How-To 0 May 8th, 2005 07:08 PM
Difference between two dates in Vb.net bimal VS.NET 2002/2003 5 August 15th, 2004 11:32 PM
how to calculate difference in dates ashu_gupta75 Excel VBA 3 August 9th, 2004 06:11 AM



All times are GMT -4. The time now is 05:17 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.