Date Query

nia

Registered User.
Local time
Today, 23:00
Joined
Oct 30, 2003
Messages
21
Hello all,
Is it possible to create a field that will calculate the difference in days between two fields that are in Date format....that are all in the same query...??
Thanks
Nia
 
Code:
NewField: DateDiff("d", [StartDate], [EndDate])
 
Yes. Use the DateDiff() function. It does subtract dates and will return a value in Days if you use the correct syntax. Look it up in Access Help.

Edit: Sorry, I refered to DateAdd before and have changed this posting to correct it.
Edit Again: And then Mile beat me to it anyway!
 
Last edited:
Thanks a million for yer help guys, sorry for the delay in relaying my thanks...
Again much appreciated.
Nia
 
Bug in Access 2003?

Mile-O-Phile said:
Code:
NewField: DateDiff("d", [StartDate], [EndDate])

Hello I am trying to use the above code in a Query and Access tells me that the syntax is either wrong or something is missing. Do you know anything about this?

Thanks,

Mauro
 
Rich said:
"dd" or "y"

Access 2003 Help shows the following syntax:

Sintaxe

DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])

Where Interval is

Configuração Descrição
yyyy Ano
q Trimestre
m Mês
y Dia do ano
d Dia
w Dia da semana
ww Semana
h Hora
n Minuto
s Segundo

Nevertheless it does not work.

How would you retrieve the number of days between today "Date()" and a given date "DeliveryDate" in an Access 2003 Query?

Many thanks,

Mauro
 

Users who are viewing this thread

Back
Top Bottom