Skip to main content

Notifications

Community site session details
Power Apps - Building Power Apps
Answered

Format date in a dropdown

Like (0) ShareShare
ReportReport
Posted on 7 Nov 2019 15:49:46 by 83

Hi,

 

I Have a PowerApp that manages Events, and the user must select the date of the event.

I can filter the event's date with my dropdown containing events, and it shows me the multiple different start date.

 

But there is the hour too, and I can't let it...

 

So I need : DD/MM/YYYY
But

It shows me : DD/MM/YYYY 00:00

 

How can I format this date ?

 

Thanks in advance ! 😉

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    on 08 Nov 2019 at 09:13:00
    Re: Format date in a dropdown

    Hi @Romsteck ,

    Please consider take a try with the following workaround:

    Set the Items property of the Dropdown2 to following:

    GroupBy(
     Filter(
     AddColumns(Events; "FormattedDate"; Text('Start Date'; "dd/mm/yyyy"));
     Name = Dropdown1.Selected.Result
     ); 
     "Start Date",
     "FormattedDate",
     "GroupData"
    )

    then set the "FormattedDate" column as display value within Dropdown box.

     

    Set the Items property of the Gallery1 to following:

    SortByColumns(
     Filter(
     Invitations; 
     Event.'Start Date' = Dropdown2.Selected.'Start Date' /* <-- Modify formula here */
     ); 
     "rcr_name"
    )

     

    Please take a try with above formula, check if the issue is solved.

     

    Best regards,

  • Romsteck Profile Picture
    83 on 08 Nov 2019 at 08:52:38
    Re: Format date in a dropdown

    Hi @v-xida-msft,

     

    Thank you for your reply.

     

    The DateTimeValue returns me a format that appears to be good, but I still can't filter the Gallery1...

     

     

    DateTimeValue(Dropdown2.Select.Result;"fr")

     

    Return : DD/MM/YYYY 00:00

     

    I see the following error :

     

    "A binary operator with incompatibles types was detected. Found Operand Types 'Edm.DateTimeOffset' and 'Edm.String' for operor kind 'equal'."

  • v-xida-msft Profile Picture
    on 08 Nov 2019 at 07:37:02
    Re: Format date in a dropdown

    Hi @Romsteck ,

    I have made a test on my side, please take a try with the following workaround:

    Set the Items property of the Dropdown2 to following:

    Distinct(
     Filter(
     AddColumns(Events; "FormattedDate"; Text('Start Date'; "dd/mm/yyyy"));
     Name = Dropdown1.Selected.Result
     ); 
     'FormattedDate'
    )

    Set the Items property of the Gallery1 to following:

    SortByColumns(
     Filter(
     Invitations; 
     Event.'Start Date' = DateValue(Dropdown2.Selected.Result) /* <-- Modify formula here */
     ); 
     "rcr_name"
    )

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • Romsteck Profile Picture
    83 on 08 Nov 2019 at 07:26:09
    Re: Format date in a dropdown

    Hi,

     

    Thank you for your answers 😁

    Yes that's my problem.

     

    I tried your solution, and it formats the date in the dropdown.

     

    But there is another problem now :

    I cant filter the Gallery1 whith this dropdown, this value can't be evaluated by the filter...

     

    The original formula for the Items settings in the Dropdown2 is :
    Distinct( Filter( Events; Name = Dropdown1.Selected.Result ); 'Start Date' ) --> It's filtering with the event's name.

     

    And the filter for Gallery1 :
    SortByColumns( Filter( Invitations; Event.'Start Date' = Dropdown2.Selected.Result ); "rcr_name" )

     

    Do you have an solution to filter the gallery selecting the formated date ?

     

    Thanks 😉

    Best regards,

  • v-xida-msft Profile Picture
    on 08 Nov 2019 at 06:42:02
    Re: Format date in a dropdown

    Hi @Romsteck ,

    Do you want to format the date value within the Dropdown box?

    Could you please share more details about the formula you provided within the Items property of the Dropdown box?

     

    If you want to format the date value within the Dropdown box, I afraid that there is no direct way to achieve your needs. As an alternative solution, please consider take a try with the following workaround:

    Set the Items proprety of the Dropdown box to following:

    Filter(
     AddColumns(
     'YourDataSource',
     "FormattedDate",
     Text('Start Date', "dd/mm/yyyy") /* <-- 'Start Date' represents the Date type column you want to display in the Dropdown box */
     ),
     FilterColumn = ...
    )

    Then within your Dropdown box, set the "FormattedDate" column as Display column value. Set the Value property of the ComboBox to following:

    FormattedDate

     

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on 07 Nov 2019 at 19:34:14
    Re: Format date in a dropdown

    Hi @Romsteck ,

    You can use the AddColumns() function to the datasource of the dropdown to add a formatted datetime and then select that column to show in the Dropdown. 

    AddColumns(datasource,"EDate",Text(EventDate,ShortDate))

     So if the column in the datasource is EventDate, then you can select Edate to show in the window of the dropdown control.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started
Loading started