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 / Capturing Date and tim...
Power Apps
Unanswered

Capturing Date and time after selecting Completed on a drop down

(0) ShareShare
ReportReport
Posted on by 78

Annotation 2022-03-03 111351.pngAnnotation 2022-03-03 111531.pngsnip for power automate .png

Here is what I have on the drop down -


If(
DataCardValue96.Selected.Value= "Completed", DateValue3, Now()
);

 

In the time card I have this 

Text(Now())

 

 

Basically I have a drop down.. when someone clicks complete, I want the time and date to be stamp in that box. I am not getting an error on the drop down code, but when I click it, it does not capture the time.

 

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @karlamaddox1 

    It's not quite clear what you have and where from your description.

    Now() is a function that evaluates at one point in time.  So the trick is to get a snapshot (in a variable) of the time.

    So, on your Dropdown OnChange action, the following formula:

    UpdateContext({lclChangeTime: 
     If(Self.Selected.Value = "Completed", Now(), Blank)
    })

    Then, for your DefaultDate property (you do not want to use the Text function as you have as the DefaultDate property wants an actual date - not text) set the property to lclChangeTime

     

    I hope this is helpful for you.

  • karlamaddox1 Profile Picture
    78 on at

     

    Thank you for the code.. I am getting an error stating that the function 'if' has some invalid arguments. 

    Annotation 2022-03-03 115428.png

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at
    UpdateContext({lclChangeTime: 
     If(Self.Selected.Value = "Completed", Now(), Blank())
    })

     

    I dont want to steal the sollution but I think there is some () missing.

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,

    Gonçalo Nogueira

    Check my LinkedIn!

    Buy me a coffee!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @karlamaddox1 

    Oops sorry, I omitted some parens!

    The Formula should be the following:

    UpdateContext({lclChangeTime: 
     If(Self.Selected.Value = "Completed", Now(), Blank())
    })
  • karlamaddox1 Profile Picture
    78 on at

    karlamaddox1_0-1646335849725.png

    Thank you... I updated the on change for the drop down.. now when I change to completed, it does give me the date but not the time. What am I doing wrong? 

  • karlamaddox1 Profile Picture
    78 on at

    karlamaddox1_0-1646336140614.png

    Thank you for responding first and quickly. I followed your steps however the hours and minutes have do populated for me.. what should I put in? Thank you 

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @karlamaddox1 

    You will need to change the formula on the hour and minute dropdown as well.  

    You would do that on the Default properties of those controls.

     

    However, I see this is a form, so you should really be changing the Default property of the DataCard to reflect the logic and not the individual controls in the datacard.  

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard