I have two date fields, when a user enters a date in datefield1 (dd/MM/YYY) eg 20/11/2024 I want the date in datefield2 to add 3 years to that date and show 20/11/202027. I have tried dateAdd(StartDate, "M", 36)
but date add isn't a valid function
I have two date fields, when a user enters a date in datefield1 (dd/MM/YYY) eg 20/11/2024 I want the date in datefield2 to add 3 years to that date and show 20/11/202027. I have tried dateAdd(StartDate, "M", 36)
but date add isn't a valid function
1 Answer
Reset to default 0You're on the right track. Adding years is this format:
datefield1.AddYears(3)
It's a blind add of 3 years though & has caused me some issues in the past with accuracy I needed.
Keep leap years in mind because 2/29/2024 + 3 years won't give the same date.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742361540a4429490.html
评论列表(0条)