web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add days to a differen...
Power Apps
Unanswered

Add days to a different date field

(0) ShareShare
ReportReport
Posted on by 117

Hi there, I am trying to add 30 days to a datefield. The extra 30 days should be calculated using a different date field. I found a few other topics about this but they seem not to work for me. Especially this topic seems similar to my question. But when I use the same code I get an error. It's Dutch but it's saying it has unexpected characters. 

 

DatePicker 1 corresponds to the field 'Datum uitdienst' and DatePicker2 corresponds to the field 'Datum e-mail verwijderen'. I want DatePicker2 to add 30 days to DatePicker1. DatePicker1 has a default value of Today() to show current day but this date will change once the user starts filling in the form.

date.jpg

 

What am I doing wrong here?

 

Thanks in advance.

Categories:
I have the same question (0)
  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Ewoud

     

    Can you replace the commas with semi-colons in your formula, and see if that removes the error?

     

    DateAdd(DatePicker1.SelectedDate;30;Days)
  • Ewoud Profile Picture
    117 on at

    Hi @timl,

     

    Thanks for the suggestion. Unfortunately it throws me a different error. Something about an invalid name and not recognizing the ID.

    date2.jpg

     

    But then I changed the value of Datepicker into the name of the field which is 'Datum uitdienst'. It looks like that works, sort of. As you can see it doesn't add 30 days but just 8 days. And when I fill in the form and change the date of 'Datum uitdienst' nothing happens, and it also shows a default date of 31-12-2001.

     

    I also tried to use DataCardValue5 but that also gives an error.

  • Ewoud Profile Picture
    117 on at

    Sorry, forgot to add the second image.

    datum3.jpg

  • Verified answer
    timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Ewoud

    Looking at your screenshot, it looks like DatePicker1 is a card rather than a date picker control.

    Can you expand the DatePicker1 node (the bit highlighted in yellow), and find the name of the date picker? It'll look something like DataCardValueXXXX - similar to the control that I marked in blue.

     

    image.png

    Next, use this control name in your formula like so and it should hopefully solve the problem.

    DateAdd(DataCardValueXXXX.SelectedDate; 30; Days)

     

  • Ewoud Profile Picture
    117 on at

    Hi @timl,

     

    You are a genius. I tried a formula that didn't contain the 'SelectedDate' part. But now that I did it works like a charm.

     

    Thank you very much for your help!

  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Thanks @Ewoud! I'm glad the problem is solved.

  • Gnanavel_V Profile Picture
    4 on at

    DateAdd(DatePicker2.SelectedDate,30,Days)

    Now its updated u can use comma

  • Gnanavel_V Profile Picture
    4 on at

    I want to display a day's count in 365.

    I tried the DateDiff it working only for one year after it's counting like 356,357,358...

    DateDiff( Now(), DateValue("1/1/2021") )

  • dropkic4u Profile Picture
    24 on at

    The function didn't work for me until I changed the semi-colon to just a comma and add the "TimeUnit" like so:

    DateAdd(DataCardValue55.SelectedDate,4,TimeUnit.Years)
    I have a field called "Date of Purchase" and thereby add fours years to the "Warranty Expiration Date"
    Maybe it has something to do with the language but nonetheless, it was enough to help solve my issue. Thanks for the help timl.
  • timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    You're welcome @dropkic4u - glad to help.

    To clarify, the orginal post related to Power Apps running in the Dutch language. This uses a semi-colon as the function argument separator. If you're using English, the correct character as you've noted is a comma. Also, since the orginal post in 2019, it's now necessary to fully qualify the time unit by prefixing it with TimeUnit, which explains the second bit of behaviour that you're seeing.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard