Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Unexpected result using Datediff

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gerardo - 26 May 2008 23:21 GMT
I'm trying to work with graphs and dates, in my code I'm using Datediff to
get the serial number for a given date and then graph the value. The problem
is that the difference between 04/01/2008 (mm/dd/yyyy) and 01/01/1900 is
giving the serial number of 2 days earlier. I know that I should add one to
get the serial number for April 1st 2008, instead I'm getting the serial
number for March 31st 2008.

Isn't this odd?
Norman Jones - 26 May 2008 23:31 GMT
Hi Gerardo,

See Chip Pearson at:

         Dates And Times In Excel
         http://www.cpearson.com/excel/datetime.htm#AddingDates

See particularly the section entitled:

       How Excel Stores Dates And Times

---
Regards.
Norman

> I'm trying to work with graphs and dates, in my code I'm using Datediff to
> get the serial number for a given date and then graph the value. The
[quoted text clipped - 6 lines]
>
> Isn't this odd?
Gerardo - 27 May 2008 04:17 GMT
Thank you, that was interesting, the funny thing is that within a worksheet,
calculating the difference using cells works just fine.

> Hi Gerardo,
>
[quoted text clipped - 21 lines]
> >
> > Isn't this odd?
Howard Kaikow - 27 May 2008 00:24 GMT
> I'm trying to work with graphs and dates, in my code I'm using Datediff to
> get the serial number for a given date and then graph the value. The problem
[quoted text clipped - 4 lines]
>
> Isn't this odd?

1900 was not a leap year, that may account for the difference of 1.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.