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 / Patch a Date and Time ...
Power Apps
Answered

Patch a Date and Time Field into Dataverse (not from a Date Picker)

(0) ShareShare
ReportReport
Posted on by 14

Hello,

I'm struggling to do something that I thought was simple and I'm sure that I missing something (simple) but at the same I know how sometimes PowerApps really makes simple things complicated (...low code solution??...anyway).

 

I'm trying to do the patching into Dataverse of a Date&Time field with this code:
ForAll( Filter(Gallery.AllItems,Field1<>Blank()),
Patch( 'Data Source' , LookUp('Data Source' As this, ThisRecord.'Field A'&ThisRecord.'Field B' = this.'Field A'&this.'Field B'), {
'Final Date': FieldX.Text
}));

 

'Final Date' is formatted as Date&Time in Dataverse.

I tried to use the functions DataValue, DateTime, DateTimeValue for FieldX but with no luck.

 

Any help is appreciated, thanks!

Categories:
  • Verified answer
    SpongYe Profile Picture
    5,909 Super User 2026 Season 2 on at

    Hi @ragnezza 

     

    It’s possible that the format of the date and time in FieldX.Text is not recognized by these functions.

    What is the format of FieldX.Text?

    If it is "11-28-2023 00:12" try this:

     

    ForAll( 
     Filter(Gallery.AllItems, Field1 <> Blank()),
     Patch( 
     'Data Source', 
     LookUp(
     'Data Source' As this, 
     ThisRecord.'Field A' & ThisRecord.'Field B' = this.'Field A' & this.'Field B'
     ), 
     {
     'Final Date': 
     DateValue(Text(Mid(FieldX.Text, 1, 10))) + 
     Time(Value(Mid(FieldX.Text, 12, 2)), Value(Mid(FieldX.Text, 15, 2)), 0)
     }
     )
    );

     

    SpongYe_0-1701208767144.png

     

     

     If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @ragnezza,

    There is something syntax wrong with your Patch(),please modify as below:

    ForAll( Filter(Gallery.AllItems,Field1<>Blank()),
    Patch( 'Data Source' , 
    LookUp('Data Source' As this, ThisRecord.'Field A Control Name'=this.'Field A'&&ThisRecord.'Field B Control Name' = this.'Field B'), 
    {
    'Final Date': DateTimeValue(FieldX_ControlName.Text)
    }
    ));
    
  • ragnezza Profile Picture
    14 on at

    Thanks for your reply. I don't understand what Control Name is and how it got into the key?

  • ragnezza Profile Picture
    14 on at

    thanks, this seems to be working!

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 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard