Need help working with dates

rinova

Registered User.
Local time
Today, 04:39
Joined
Aug 27, 2012
Messages
74
Good afternoon Everyone,

Any help will be appreciated.

I have a date of birth field (DOB) and want to be able to add 23 years to the DOB then I want to take the result and modify the date to the last day of the year.

Example:
DOB = 11/17/1969
Date Became 23 = 11/17/1992
Modify Date Became 23 = 12/31/1992

Thank you,

Rich
 
You can use Year() to pull out the DOB year, add 23 to it and use that with DateSerial().
 
To add 23 years to the DOB I used this "DateBecame23: DateAdd("yyyy",23,[DOB])"

To Modify the date to Last day of Year (LDOY) I used this "LDOY: DateSerial(Year([DateBecame23]),12,31)"

I don't know how to join these two functions into one function.
 
Last edited:
You could use,
Code:
LDOY: DateSerial(Year(DateAdd("yyyy", 23, [DOB])), 12, 31)
 
Yep, that works perfectly!

Thank you so much!
 
Why the unnecessary function call ,just

LDOY: DateSerial(Year([DOB]+23, 12, 31)

Brian
 
When I tried
Code:
LDOY: DateSerial(Year([DOB]+23, 12, 31)
I received a message saying "The Expression you entered has a function containing the wrong number of arguments."

I reviewed the code and added a closed parenthesis after +23 and it ran without any error messages but it didn't produce the result I was looking for.

Code:
LDOY: DateSerial(Year([DOB]+23[B][COLOR="Red"])[/COLOR][/B], 12, 31)

-Rich
 
I believe you have that misplaced. It should be:

DateSerial(Year([DOB])+23, 12, 31)

Otherwise you're adding 23 days, not years.
 
Your correct Paul, I corrected the code and it works, Awesome!

Thanks Brian and Paul!

-Rich
 
No problem; that's exactly what I was suggesting in post 2 by the way.
 
Is it still a typo when you leave something out (didn't type it)? Maybe that's a "NoTypo". :p
 

Users who are viewing this thread

Back
Top Bottom