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 / 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:
  • 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,970 Super User 2026 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

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
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard