Date difference

  • Thread starter EMILYTAN via AccessMonster.com
  • Start date
E

EMILYTAN via AccessMonster.com

May I know how to do a date different between a given date in a field and
today's date.

I want to add a field on aging and calculate the date difference in query.

For example : Aging = diff( transaction date, today date)

Thanks
 
S

Stefan Hoffmann

hi Emily,
May I know how to do a date different between a given date in a field and
today's date.
If your result should be a date:

= CDate(dtToday - dtTransaction)

otherwise take a look at DateDiff() in the online help.


mfG
--> stefan <--
 
E

EMILYTAN via AccessMonster.com

I mean in a query table?
What should I add in?
Stefan said:
hi Emily,

If your result should be a date:

= CDate(dtToday - dtTransaction)

otherwise take a look at DateDiff() in the online help.

mfG
--> stefan <--
 
J

Jamie Collins

If your result should be a date:

= CDate(dtToday - dtTransaction)

That doesn't sound correct e.g.

SELECT CDate(DATE() - #2007-07-23 00:00:00#) AS result_datetime

returns a DATETIME value sometime around the turn of the last century :
(
otherwise take a look at DateDiff() in the online help.

Yes, I think the OP would want something more like:

SELECT DATEDIFF('D', #2007-07-23 00:00:00#, DATE()) AS result_days

Jamie.

--
 
S

Stefan Hoffmann

hi Jamie,

Jamie said:
That doesn't sound correct e.g.
SELECT CDate(DATE() - #2007-07-23 00:00:00#) AS result_datetime
returns a DATETIME value sometime around the turn of the last century
Which is exactly the date span between the two dates based on the
default start date of the date type.
But I have to admit, that this is maybe not what she wanted.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Microsoft Access 0
Difference between two dates 2
Date Diff in a query or form 3
Format on date 1
elapsed days in query 6
calculate difference between dates 5
Calculate Diff Date? 3
=Date() Problem 2

Top