which function?

L

Lauren

I want to subtract two dates from each other that will
give me a result of the number of days only. For example:
1/30/2003-1/20/2003 = 10 days
Which function should I use and how should it be written?

Thanks in advance!!
 
C

Cheryl Fischer

The DateDiff() function will do what you want. Here is an example that you
can try out as code behind a command button.

Dim x As Variant

x = DateDiff("d", #1/20/2003#, #1/30/2003#)

MsgBox x & " days"

hth,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top