DateDiff to produce answer in 'yrs, mths, dys'

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

This expression below works perfectly, but what I need to add to it, which I
seem to have difficulty with, is to show how many days as well.

=DateDiff("m",[Date of Joining],Now())\12 & " yrs " & DateDiff("m",[Date of
Joining],Now()) Mod 12 & " mths"

Please can someone show me how to produce an answer like:
'19 yrs 6 mths 10 dys' (for example)

Kind regards

Rigby
 
Thank you, I had actually just found it and used it. It does what I want BUT,
it is returning the wrong number of days. it says that from date1 (eg. 9 Dec
1996) to Now() = 9 yrs 2 mths 8 dys
which is wrong. it should be '19 dys'

Any ideas as to why it does this?

Thank you for your quick and helpful response.

Rigby


Ofer said:
Try this link

http://www.accessmvp.com/djsteele/Diff2Dates.html

--
\\// Live Long and Prosper \\//
BS"D


rigby said:
Hi

This expression below works perfectly, but what I need to add to it, which I
seem to have difficulty with, is to show how many days as well.

=DateDiff("m",[Date of Joining],Now())\12 & " yrs " & DateDiff("m",[Date of
Joining],Now()) Mod 12 & " mths"

Please can someone show me how to produce an answer like:
'19 yrs 6 mths 10 dys' (for example)

Kind regards

Rigby
 
I tried it and it gave me the right resault, mybe check the date in your
computer.

--
\\// Live Long and Prosper \\//
BS"D


rigby said:
Thank you, I had actually just found it and used it. It does what I want BUT,
it is returning the wrong number of days. it says that from date1 (eg. 9 Dec
1996) to Now() = 9 yrs 2 mths 8 dys
which is wrong. it should be '19 dys'

Any ideas as to why it does this?

Thank you for your quick and helpful response.

Rigby


Ofer said:
Try this link

http://www.accessmvp.com/djsteele/Diff2Dates.html

--
\\// Live Long and Prosper \\//
BS"D


rigby said:
Hi

This expression below works perfectly, but what I need to add to it, which I
seem to have difficulty with, is to show how many days as well.

=DateDiff("m",[Date of Joining],Now())\12 & " yrs " & DateDiff("m",[Date of
Joining],Now()) Mod 12 & " mths"

Please can someone show me how to produce an answer like:
'19 yrs 6 mths 10 dys' (for example)

Kind regards

Rigby
 
I checked my date and time settings on my computer and they are all as
normal. I am set to UK date format, will this make a difference. I ask as I
just copied and pasted and adjusted control names to fit the code, I am not
well educated with VBA.

please advise mighty Ofer :]

Kind Regards

Rigby



Ofer said:
I tried it and it gave me the right resault, mybe check the date in your
computer.

--
\\// Live Long and Prosper \\//
BS"D


rigby said:
Thank you, I had actually just found it and used it. It does what I want BUT,
it is returning the wrong number of days. it says that from date1 (eg. 9 Dec
1996) to Now() = 9 yrs 2 mths 8 dys
which is wrong. it should be '19 dys'

Any ideas as to why it does this?

Thank you for your quick and helpful response.

Rigby


Ofer said:
Try this link

http://www.accessmvp.com/djsteele/Diff2Dates.html

--
\\// Live Long and Prosper \\//
BS"D


:

Hi

This expression below works perfectly, but what I need to add to it, which I
seem to have difficulty with, is to show how many days as well.

=DateDiff("m",[Date of Joining],Now())\12 & " yrs " & DateDiff("m",[Date of
Joining],Now()) Mod 12 & " mths"

Please can someone show me how to produce an answer like:
'19 yrs 6 mths 10 dys' (for example)

Kind regards

Rigby
 
I also copy and paste the code, and try the Immidiate window with

?Diff2Dates("ymd", #09/12/1996#, Now())

Try this and tell me what do you get

--
\\// Live Long and Prosper \\//
BS"D


rigby said:
I checked my date and time settings on my computer and they are all as
normal. I am set to UK date format, will this make a difference. I ask as I
just copied and pasted and adjusted control names to fit the code, I am not
well educated with VBA.

please advise mighty Ofer :]

Kind Regards

Rigby



Ofer said:
I tried it and it gave me the right resault, mybe check the date in your
computer.

--
\\// Live Long and Prosper \\//
BS"D


rigby said:
Thank you, I had actually just found it and used it. It does what I want BUT,
it is returning the wrong number of days. it says that from date1 (eg. 9 Dec
1996) to Now() = 9 yrs 2 mths 8 dys
which is wrong. it should be '19 dys'

Any ideas as to why it does this?

Thank you for your quick and helpful response.

Rigby


:

Try this link

http://www.accessmvp.com/djsteele/Diff2Dates.html

--
\\// Live Long and Prosper \\//
BS"D


:

Hi

This expression below works perfectly, but what I need to add to it, which I
seem to have difficulty with, is to show how many days as well.

=DateDiff("m",[Date of Joining],Now())\12 & " yrs " & DateDiff("m",[Date of
Joining],Now()) Mod 12 & " mths"

Please can someone show me how to produce an answer like:
'19 yrs 6 mths 10 dys' (for example)

Kind regards

Rigby
 
Back
Top