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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Updating Date values i...
Power Apps
Answered

Updating Date values in a collection

(0) ShareShare
ReportReport
Posted on by 195

Hi, 

I have a collection which has a number of date fields.

Can anyone advise what command I can run to change the date values in that collection?

For example, if I want to change all dates that match 01/01/2020 (UK format) to be 31/12/2020.

 

Presumably it's an UpdateIf statement required, but PowerApps is not liking my syntax so far.

 

Many thanks

Paul

Categories:
  • rsaikrishna Profile Picture
    3,703 on at

    @PJBruen 

     

    Created a sample collection as below:

    ClearCollect(colDates, [{Title: "Sam", Date: "11/12/2020"}, {Title: "David", Date: "11/10/2020"}, {Title: "John", Date: "11/12/2020"}, {Title: "Jason", Date: "11/12/2020"}])

     

    Placed a button on the screen and OnSelect wrote following formula:

    UpdateIf(colDates,Value.Date="11/12/2020",{Value: {Title: Value.Title, Date: "11/09/2020"}})

     

    On clicking the button, it uses UpdateIf function to check the date value "11/12/2020" in the collection and replaces with "11/09/2020" for each item in the collection.

     

    I hope this will be useful for you.

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted Solution. Marking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.
  • PJBruen Profile Picture
    195 on at

    Hi, @rsaikrishna - thanks for your reply.

    I'm still having a little trouble getting this right. Here's what I have:

     

    colStressTestTimeline

    PJBruen_0-1606314674801.png

     

    The formula I have is: UpdateIf(colStressTestTimeline, KeyMilestone_StartDate="24/09/2020", {Title: "2019/2019 - BES", KeyMilestone_StartDate: "01/01/1900"});

     

    I know this slightly differs to yours, but the syntax of value.KeyMilestone_StartDate didn't appear valid.

     

    Any ideas?

    Thanks. Paul

     

  • PJBruen Profile Picture
    195 on at

    @rsaikrishna 

    Sorry - not sure I can reply to the meeting request..

  • rsaikrishna Profile Picture
    3,703 on at

    @PJBruen 

     

    In your collection, do you see Records or direct values as shown in your screen shot?

     

    If you see direct values, then you do not need to use value.KeyMilestone_StartDate. 

     

    When you use the following formula:

    UpdateIf(colStressTestTimeline, KeyMilestone_StartDate="24/09/2020", {Title: "2019/2019 - BES", KeyMilestone_StartDate: "01/01/1900"});

     

    Do you see any issues with above formula? If so, share the details of the error.

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted Solution. Marking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

     

  • PJBruen Profile Picture
    195 on at

    Hi @rsaikrishna 

    The collection is as per the screenshot, so I see records that have been populated by a ClearCollect call against a Sharepoint site.

     

    regards.

  • PJBruen Profile Picture
    195 on at

    @rsaikrishna - the error I see is:

    PJBruen_0-1606316674549.png

     

  • rsaikrishna Profile Picture
    3,703 on at

    @PJBruen 

     

    When you use the following formula:

    UpdateIf(colStressTestTimeline, KeyMilestone_StartDate="24/09/2020", {Title: "2019/2019 - BES", KeyMilestone_StartDate: "01/01/1900"});

     

    Do you see any issues with above formula? If so, share the details of the error.

  • PJBruen Profile Picture
    195 on at

    Sorry - see above...

  • Verified answer
    rsaikrishna Profile Picture
    3,703 on at

    @PJBruen 

     

    Try using following:

    UpdateIf(colStressTestTimeline, KeyMilestone_StartDate=Date(2020,09,24), {Title: "2019/2019 - BES", KeyMilestone_StartDate: Date(1900,1,1)});

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted Solution. Marking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.
  • PJBruen Profile Picture
    195 on at

    @rsaikrishna  You 🌟

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard