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 / Set datepicker date of...
Power Apps
Answered

Set datepicker date of my choice

(0) ShareShare
ReportReport
Posted on by 364 Moderator

Hello,

 

By pressing a button, I want to set the start and the end of event in a datepicker.

Hours and minutes are important because some events start and end the same day. Values are then saved in a SharePoint list.

 

How can I pass a date and a time value in a datepicker?

 

PierreCA_0-1704826674769.png

 

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

    Hi @PierreCA 

     

    I recreated your case:

     

    create a new variable button1.OnSelect:

    Set(DateNow, Text(Now(), "dd/mm/yyyy hh:mm:ss"))

     

    Datepicker.Default:

    DateNow

     

    Than I added 2 dropdowns one for hours and one for minutes:


    DropdownHours.Items

    ["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"]

    DropdownHours.Default:

    Hour(DateNow)

     

    DropdownMinutes.items

    ["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"]

    DropdownMinutes.Default:

    Minute(DateNow)

     

    My example:

    SpongYe_0-1704829689988.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! 🍻

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @PierreCA,

     

    We can leverage the logic from within the default Form control. This would require 1 DatePicker (DateValue) and 2 Dropdowns (hour & minutes):

    LaurensM_0-1704829385345.png

     

    In order to create this set-up you can follow the steps below - repeat these steps for the end time but use a different variable (e.g. gblStop).

     

    (1) Button OnSelect will save the current time to a variable called gblStart:

    Set(gblStart, Now())

     

    (2) Set the DefaultDate property of your DatePicker to the variable:

    gblStart

     

    (3) The hours dropdown should have the following code:

    //Items property (Display "00" until "23")
    ForAll(Sequence(24,0),Text(Value, "00"))
    
    //Default property
    Text(Hour(gblStart),"00")

     

    (4) The minute dropdown will require the following code:

    //Items property (Display "00" until "59")
    ForAll(Sequence(60,0),Text(Value, "00"))
    
    //Default property
    Text(Minute(gblStart),"00")

     

    Saving this to SharePoint can be done via a Patch statement. The code will depend on what you would like to achieve - create new rows or update an existing one?

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard