Date different between date and today date?

J

Jon

Greeting,

I need to calculate the number of months between date1 and today date2 if
date2 is equal to date1 after that the number will be multiplied in a
textboxâ€text1†which is a number. Finally, the total(date1-dat2*text1) will
be subtracted from another filed “text2â€

For example:
If date1 is 01/16/2008 and date2 is 04/16/2008 then the result is 3 months
the formula will be as follow
(3*text1)-text2

How can I do that please??
 
D

Douglas J. Steele

What difference do you want reported between 01/16/2008 and 04/15/2008? What
about between 01/01/2008 and 04/30/2008? Access has a built-in DateDiff
function, but you need to understand how it works. If you're looking for the
number of months between two dates, Access will count it as one whenever the
month changes. In other words, DateDiff("m", #01/31/2008#, #02/01/2008#)
will return 1, as will DateDiff("m", #01/01/2008#, #02/29/2008#). As you can
see, though, the first case is only 1 day, while the second case is 59 days.
 
T

Tom van Stiphout

On Mon, 4 Aug 2008 05:53:01 -0700, Jon <[email protected]>
wrote:

Check out the DateDiff function in the help file. It is there
specifically to do this kind of date math.

-Tom.
Microsoft Access MVP
 
T

Tom van Stiphout

On Mon, 04 Aug 2008 15:08:49 GMT, "Linq Adams via AccessMonster.com"

I disagree. DateDiff is not problematic, it is entirely predictable.
The help file is quite clear on the "problems" you cite. For example:
<quote>
When comparing December 31 to January 1 of the immediately succeeding
year, DateDiff for Year ("yyyy") returns 1 even though only a day has
elapsed.
</quote>

Now dividing days by 30.4 to get to months, that's what I would call
problematic. Date math does not have to be approximate.

-Tom.
Microsoft Access MVP
 
Joined
Aug 30, 2016
Messages
1
Reaction score
0
Hello,

I am very new to Access and I am attempting to do something similar to the above in Access 2010. I would like to calculate the years and months between a date (field name is "Hire Date") and today (field name "Time Employed") in a table which can then be added as a field on a form for viewing only and cant be changed.

I started by making the data type of the "Time Employed" field 'calculated' and tried using the foundation for the formula as below. I dont know how to get it to show the years and months, and of course, its telling me the expression has a function containing the wrong number of arguments. Any assistance would be appreciated.

DateDiff([Hire Date],Date())
 

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

Top