Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any way to bring a date to the current year?

Status
Not open for further replies.

SigAdams

IS-IT--Management
Sep 27, 2010
5
0
0
US
For example, if I had the date 02/01/1987

Is there any way to automatically convert it to 02/01/2012?

Or whatever the current year happens to be?

I've tried a few things, each more clunky than the last.
 

Do you mean, convert the date in SQL? Do it in VBA? On paper?

You need to be more specific.

If VBA, you may try:
[tt]
Dim dt As Date
dt = CDate("02/01/1987")

MsgBox Month(dt) & Day(dt) & Year(Date)
[/tt]
Code not tested.

Have fun.

---- Andy
 
You wanted this ?
newDate=DateSerial(Year(Now()),Month(oldDate),Day(oldDate))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top