A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

DateDiff Calculation



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 13th 08, 11:49 PM posted to microsoft.public.outlook.program_vba
Henry Stockbridge
external usenet poster
 
Posts: 10
Default DateDiff Calculation

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
Ads
  #2  
Old August 14th 08, 11:13 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default DateDiff Calculation



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

  #3  
Old August 14th 08, 12:20 PM posted to microsoft.public.outlook.program_vba
Henry Stockbridge
external usenet poster
 
Posts: 10
Default DateDiff Calculation

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
  #4  
Old August 14th 08, 09:15 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default DateDiff Calculation



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

  #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.
 




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DateDiff Validation Function hcleb Outlook - Using Forms 0 January 21st 08 07:38 PM
File as Calculation laura Outlook - Using Contacts 0 October 4th 07 10:05 PM


All times are GMT +1. The time now is 05:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.