View Single Post
  #5  
Old August 15th 08, 01:19 AM posted to microsoft.public.outlook.program_vba
Henry Stockbridge
external usenet poster
 
Posts: 10
Default DateDiff Calculation

On Aug 14, 2:15*pm, "Michael Bauer [MVP - Outlook]"
wrote:
The funtion doesn't work that way, It's not 8/5 - 8/1, but it's the
difference *from 8/5 to 8/1,which is negative.

Simply try it, Datediff returns a negative value if Date1 Date2.

--
Best regards
Michael Bauer - MVP Outlook

* : VBOffice Reporter for Data Analysis & Reporting
* : Outlook Categories? Category Manager Is Your Tool
* : http://www.vboffice.net/product.html?pub=6&lang=en

Am Thu, 14 Aug 2008 03:20:40 -0700 (PDT) schrieb Henry Stockbridge:



On Aug 14, 4:13*am, "Michael Bauer [MVP - Outlook]"
wrote:
It's negative if date2 date1.


--
Best regards
Michael Bauer - MVP Outlook


* : VBOffice Reporter for Data Analysis & Reporting
* : Outlook Categories? Category Manager Is Your Tool
* : http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 13 Aug 2008 14:49:55 -0700 (PDT) schrieb Henry Stockbridge:


Hi,


I am attempting to calculate the difference in dates between the date
an original email message was received, and the date a reply was
sent. *However, this code returns negative numbers, despite the Date1,
and Date2 being in the right sequence.


Dim myItem As Object
Set myItem = Application.ActiveInspector.CurrentItem


DateDiff("d", Format(myItem.ReceivedTime, "Short Date"), Format(Now(),
"Short Date"))


Any thoughts?


Henry- Hide quoted text -


- Show quoted text -


Michael,


Thanks for your response. *I was probably unclear, so I will try
again. *Let's say someone sent me a message on 8/1/08. *I store that
message in my Inbox. *Then, I respond to the sender in a couple days,
say 8/5/08 by opening the message sent on 8/1 and hitting 'Reply.' *I
am trying to capture the date the original email was received (8/1)
and find out how many days have elapsed since I replied to the
sender. *The DateDiff in this example would return 4 (8/5-8/1.)


Henry- Hide quoted text -


- Show quoted text -


Thanks, Michael. I'm all set now.
Ads