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 / Storing datatime to sq...
Power Apps
Answered

Storing datatime to sql database

(0) ShareShare
ReportReport
Posted on by 9

I have an Edit form on which I have CreationDate field.

I would like to update this field with current datetime and update the database when submitform() is invoked.

 

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,925 on at
    Try this
    Patch('[dbo].[avlist] ',YourTexbox.Text, {DatefieldColumn:Now()})

    Change '[dbo].[avlist] ' to actual sql table
  • rawatn Profile Picture
    9 on at

    Where should I put that syntax?

    It will be in datacard update or submit button?

    One doubt, can I hide this in the form or say I do not add this field, but in submit button update the current datatime to database?

    Is it possible? If yes, How?

  • Verified answer
    eka24 Profile Picture
    20,925 on at
    From your questions:
    1. If you submitting the whole form with a button, then:
    Put this variable on the Onvisible of the screen:
    Set(MyTimeNow,Now())

    Then in the default of the datefield datacardvalue put:
    If(YourFormName.Mode=FormMode.Edit,MyTimeNow,Parent.Default)

    On hiding / disable the field, you can put this formula on the Displaymode of the field If(YourFormName.Mode=FormMode.Edit,View,Edit) . This will prevent them from manually changing the field.

    2. But if you are to change on the datefield without submitting the whole form then on the OnSelect of the button put:
    Patch('[dbo].[avlist] ',YourTexbox.Text, {DatefieldColumn:Now()})

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard