Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Vilhelm-Ion Praisach
  Where is Vilhelm-Ion Praisach?
 Resita
 Romania
 Vilhelm-Ion Praisach
 To: Prasant T
  Where is Prasant T?
 Thrissur, Kerala
 India
 Prasant T
 Tags
Subject: RE: Datediff in Access
Thread ID: 395375 Message ID: 395379 # Views: 48 # Ratings: 2
Version: Not Applicable Category: Databases, Tables and SQL Server
Date: Tuesday, January 14, 2014 10:28:43 AM         
   


> In MS Access query,
>
> Select DateDiff ("d", #15/10/2003#, #22/11/2003#)
>

> is returns 38.
>
> Therefore the return value of Select DateDiff ("d", #05/10/2003#, #22/11/2003#) should be 48 but it returns 196.
>
> Short date and Long date formats in system is dd/MM/yyyy.
>
>
>
>
>
> Prasant

I noticed that #15/10/2003# is interpreted by ACCESS as date(2003,10,15), while #05/10/2003# as date(2003,05,10) (sorry for the previous typo).
In general if the first number is <=12, then is interpreted as month.

SELECT DateDiff ("d", #05/10/2003#, #22/11/2003#) ,DateDiff ("d", #06/10/2003#, #22/11/2003#), DateDiff ("d", #07/10/2003#, #22/11/2003#),DateDiff ("d", #08/10/2003#, #22/11/2003#)  ,DateDiff ("d", #09/10/2003#, #22/11/2003#) ,DateDiff ("d", #10/10/2003#, #22/11/2003#) ,DateDiff ("d", #11/10/2003#, #22/11/2003#) ,DateDiff ("d", #12/10/2003#, #22/11/2003#) ,DateDiff ("d", #13/10/2003#, #22/11/2003#) ,DateDiff ("d", #14/10/2003#, #22/11/2003#) ,DateDiff ("d", #15/10/2003#, #22/11/2003#);


In my oppinion its better to use :

SELECT DateDiff ("d", #2003-10-05#, #2003-11-22#) ;


My respects

ENTIRE THREAD

Datediff in Access Posted by Prasant T @ 1/14/2014 8:48:46 AM
RE: Datediff in Access Posted by Borislav Borissov @ 1/14/2014 9:40:42 AM
RE: Datediff in Access Posted by Vilhelm-Ion Praisach @ 1/14/2014 10:28:43 AM
RE: Datediff in Access Posted by Prasant T @ 1/14/2014 10:47:59 AM