infopath - How to add years to year part of date field? - Stack Overflow

I have two date fields, when a user enters a date in datefield1 (ddMMYYY) eg 20112024 I want the da

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

Share Improve this question edited Nov 20, 2024 at 11:37 Yevhen Horbunkov 15.6k3 gold badges26 silver badges45 bronze badges asked Nov 20, 2024 at 11:25 sql2015sql2015 6113 gold badges17 silver badges36 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You'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

相关推荐

  • infopath - How to add years to year part of date field? - Stack Overflow

    I have two date fields, when a user enters a date in datefield1 (ddMMYYY) eg 20112024 I want the da

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信