web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps format the d...
Power Apps
Answered

PowerApps format the date stored by a variable

(0) ShareShare
ReportReport
Posted on by 65

Hi all,

 

Hope this will make sense!

 

I have a desk booking app that allows users to book a desk in one of our offices and once the desk has been booked for the date specified (chosen by a date picker control) it will create an entry in a SharePoint list, blocking out the desk for everyone else.

 

However, I'm running into an issue where a couple of users must have some funky region/date settings which means that their desk bookings do not appear to other users and vice versa.

 

For example, 99% of our staff will book a desk and it will appear in the SharePoint list correctly like the item marked in green. dd/MM/yyyy.

 

For a select few, it appears either like the orange highlighted item, or some other formatting that does not follow the dd/MM/yyyy format we need.

DeskBooking issue.png

 

How can I within the app, format the Date Variable to use dd/MM/yyyy, here is the formula in use, you can see the BookingDate variable set at the bottom and used in the Title & BookingDateText below:

 

Set(
 requesterClaim,
 {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & User().Email,
 Department: "",
 DisplayName: User().FullName,
 Email: User().Email,
 JobTitle: "",
 Picture: ""
 }
);
Patch(
 DeskBookings,
 Defaults(DeskBookings),
 {
 Title: DeskNumber & " " & User().FullName & " " & BookingDate,
 'Booking Date': BookingDate,
 Person: requesterClaim,
 DeskText: DeskNumber,
 BookDateText: BookingDate
 }
);
Navigate(
 ScreenBookingSuccess,
 ScreenTransition.None,
 {
 BookingDate: BookingDate,
 DeskNumber: DeskNumber
 }
);
Set(
 DeskNumber,
 Blank()
);
Set (
 BookingDate,
 Blank()
);
Set (
 varDialogVisible,
 false
)

 

Any help is massively appreciated!

Categories:
I have the same question (0)
  • vaubeee Profile Picture
    533 on at

    Hi @MHSPDev 

    looks like, in the code provided the BookingDate variable is set back to Blank() after beeing patched. 

    So, you have to search for the actual definition of this variable. Then try this to enforce the formatting needed:

     

    Text(DatePicker1.SelectedDate,DateTimeFormat.ShortDate,"en-US")

     

    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

  • Michael E. Gernaey Profile Picture
    53,452 Super User 2025 Season 2 on at

    Hello,

     

    I believe you are speaking of the BookingDate itself.

    Try this to convert it

     

    Text(DateValue(BookingDate), "dd/MM/yyyy")
    
    You may not need to use the DateValue if its already a Date but just to be safe.

     



    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • MHSPDev Profile Picture
    65 on at

    Hey, I gave this a go but unfortunately the date being pulled through to the SharePoint list is in the incorrect format.

    It should of came through as 23/09/2023 but it came through as 23/9/2023.

  • Verified answer
    vaubeee Profile Picture
    533 on at

    @MHSPDev 

    Did you also check if this works for you?

    Text(DatePicker1.SelectedDate,DateTimeFormat.ShortDate,"en-US")

    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard