By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,077 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

DateDiff Modification

iBasho
P: 16
Hi,
Is there a way to modify the DateDiff function so if both fields have the same date it will return the value of 1 instead of 0? (E.g. Both start and end date are 09/17/2007).

Thanks.
Ina
Sep 17 '07 #1
Share this Question
Share on Google+
1 Reply


puppydogbuddy
Expert 100+
P: 1,923
Hi,
Is there a way to modify the DateDiff function so if both fields have the same date it will return the value of 1 instead of 0? (E.g. Both start and end date are 09/17/2007).

Thanks.
Ina

Sure, like this:
Expand|Select|Wrap|Line Numbers
  1. Dim X As Integer              'variable to store result
  2.  
  3. If datefield1 = datefield2 Then
  4.     X = 1
  5. Else
  6.     X = DateDiff ("d", datefield1, datefield2)
  7. End If
Sep 18 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.