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 Apps
Suggested Answer

UK Date format

(0) ShareShare
ReportReport
Posted on by 2
Hello,
 
I have a dropdown (Session) pulling from a date and time field in SharePoint, that provides the date and start time of some training sessions. I would like the user to select the session they want to attend using the dropdown and then press a button to add a placeholder to their calendar, all of the sessions last 20 minutes so I have hard coded the end time increasing by 20 minutes. All works well until I get to a date bigger than 12, such as 13th December or 21st January and then I get a status 400 error, stating that string was not recognised as a valid DateTime value. Can anyone help me where I am going wrong please? 
 
 
Office365Outlook.V4CalendarPostItem(
 
    LookUp(Office365Outlook.CalendarGetTables().value,DisplayName="Calendar").Name,
//Event Title
    "Placeholder: Session 1",
 
//Session Start
    Text(DateAdd(DateTimeValue(Session.Selected.Value), -TimeZoneOffset(), TimeUnit.Minutes)),
 
//Session End
 
 
    Text(DateAdd(DateTimeValue(Session.Selected.Value), 20 +TimeZoneOffset(), TimeUnit.Minutes)),
 
   "(UTC+00:00) Dublin, Edinburgh, Lisbon, London"
)
 
Many Thanks
 
Michaela
Categories:
I have the same question (0)
  • Suggested answer
    SwatiSTW Profile Picture
    807 Super User 2025 Season 2 on at
    The problem occurs because DateTimeValue(Session.Selected.Value) anticipates that the Session.Selected.Value will be in a format that PowerApps identifies as a valid DateTime. If the format does not comport with its expectations (e.g., MM/DD/YYYY versus DD/MM/YYYY), PowerApps may misinterpret or fail to interpret the value correctly when dealing with dates beyond the 12th of a month (e.g., 13/12/2023).

    Make sure that the Session dropdown value is returned in a format that is compatible with PowerApps if it is a date-time field. The Text function can be used to ensure that a consistent format is enforced.

    Try below code

    Office365Outlook.V4CalendarPostItem(
        LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
        // Event Title
        "Placeholder: Session 1",
        // Session Start
        Text(
            DateAdd(
                DateTimeValue(Session.Selected.Value, "yyyy-MM-ddThh:mm:ssZ"),
                -TimeZoneOffset(),
                TimeUnit.Minutes
            ),
            "yyyy-MM-ddThh:mm:ssZ"
        ),
        // Session End
        Text(
            DateAdd(
                DateTimeValue(Session.Selected.Value, "yyyy-MM-ddThh:mm:ssZ"),
                20 - TimeZoneOffset(),
                TimeUnit.Minutes
            ),
            "yyyy-MM-ddThh:mm:ssZ"
        ),
        "(UTC+00:00) Dublin, Edinburgh, Lisbon, London"
    )
     
  • MD-27111611-0 Profile Picture
    2 on at
    Thanks SwatiSTW,
     
    Your explanation was really helpful. Although I am now getting a different error,  "language code null not supported".
    I have tried including "en" but still getting the error.
     
    Thanks again
     
    Michaela
  • timl Profile Picture
    36,634 Super User 2025 Season 2 on at
    Hi  MD-27111611-0
     
    Can you confirm that Session.Selected.Value is a string value, and holds a date that's formatted in "dd-mm-yyyy" format?
     
    If so, the following should work better. Note that the call to DateTimeValue should specify "en-GB" for UK dates.
    Also, the call to text should specify the month placeholder as 'mm' in lower case as opposed to uppercase (eg, "yyyy-mm-ddThh:mm:ssZ") 
     
     
     
    Office365Outlook.V4CalendarPostItem(
        LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
        // Event Title
        "Placeholder: Session 1",
        // Session Start
        Text(
            DateAdd(
                DateTimeValue(Session.Selected.Value, "en-GB"),
                -TimeZoneOffset(),
                TimeUnit.Minutes
            ),
            "yyyy-mm-ddThh:mm:ssZ"
        ),
        // Session End
        Text(
            DateAdd(
                DateTimeValue(Session.Selected.Value, "en-GB"),
                20 - TimeZoneOffset(),
                TimeUnit.Minutes
            ),
            "yyyy-mm-ddThh:mm:ssZ"
        ),
        "(UTC+00:00) Dublin, Edinburgh, Lisbon, London"
    )
     

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 393

#2
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 271 Super User 2025 Season 2

Last 30 days Overall leaderboard