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 / Power apps formula giv...
Power Apps
Answered

Power apps formula gives wrong dates on sharepoint

(0) ShareShare
ReportReport
Posted on by 24
Hi everyone, 
 
I have an unexpected issue with my app, im not sure whether it's power apps formula or something wrong with the sharepoint list
 
I have a text input, form and table, they are all submitting the data in sharepoint
the data showing in the table are date and time data with the formula DD\MM\YY HH:MM
it's showing perfectly in the table, but once submitted to the sharepoint it shows completely different entries, for example I enter 16/10/24 21:41 it appeared in the sharepoint 10/04/2025 00:51
 
columns type in the sharepoint list accepts date and time values 
the formula Im using for the submit button is 
 
If(
   CountRows(SortedDates) >= 5,
   With(
      {
         recordToSubmit:
         {
            TimeRaised: DateTimeValue(First(SortedDates).DateTime),
            TimeAssigned: DateTimeValue(Index(SortedDates, 2).DateTime),
            TimeStarted: DateTimeValue(Index(SortedDates, 3).DateTime),
            NotesAdded: DateTimeValue(Index(SortedDates, 4).DateTime),
            TimeCompleted: DateValue(Last(SortedDates).DateTime)
         }
      },
      Patch(
         'CRM Priority (Do Not Use)',
         Defaults('CRM Priority (Do Not Use)'),
         recordToSubmit,
         Form1.Updates
      );
      Notify(
         "All dates submitted successfully!",
         NotificationType.Success
      );
      ResetForm(Form1)
      & Reset(TextInput1)// Reset the form after submission
   ),
   Notify(
      "Not enough dates to submit!",
      NotificationType.Error
   )
);
 
 
I have tried to add a text label separately with the formula 
 
DateTimeValue(First(SortedDates).DateTime)
 
I added a date in 2024 nut it show me a date in 2025
  • WarrenBelz Profile Picture
    156,958 Most Valuable Professional on at
    If you are storing your dates in a Text field in the format DD\MM\YY HH:MM, then be prepared for some complexities if you want to get that back into a "proper" date (according to US based mentality). You are better storing them as MM/DD/YYYY HH:MM and your current code would work, so before I go down the track of on the fly conversion, are you able to do this ?
  • Suggested answer
    AM-27101151-0 Profile Picture
    24 on at
    Hi, @WarrenBelz 
     
    yes you are right, when I changed the entries it gave me the correct values, but the problem is, entries should be copied and pasted same as it is, users should not change it everytime 
  • Verified answer
    WarrenBelz Profile Picture
    156,958 Most Valuable Professional on at
    Lucky I had some time to spend on some mind-numbing code  . . .  if you really want to get all of that back to the format you want
    If(
       CountRows(SortedDates) >= 5,
       With(
          {
             _DT1: 
             Split(
                Left(
                   First(SortedDates).DateTime,
                   8
                ),
                "/"
             ).Value,
             _DT2: 
             Split(
                Left(
                   Index(
                      SortedDates,
                      2
                   ).DateTime,
                   8
                ),
                "/"
             ).Value,
             _DT3: 
             Split(
                Left(
                   Index(
                      SortedDates,
                      3
                   ).DateTime,
                   8
                ),
                "/"
             ).Value,
             _DT4: 
             Split(
                Left(
                   Index(
                      SortedDates,
                      4
                   ).DateTime,
                   8
                ),
                "/"
             ).Value,
             _DT5: 
             Split(
                Left(
                   Last(SortedDates).DateTime,
                   8
                ),
                "/"
             ).Value
          },
          With(
             {
                _Date1: 
                DateTimeValue(
                   Index(
                      _DT1,
                      2
                   ).Value & "/" & First(_DT1).Value & "/" & "20" & Last(_DT1).Value & " " & 
                   Mid(
                      First(SortedDates).DateTime,
                      10,
                      2
                   ) & ":" & 
                   Right(
                      First(SortedDates).DateTime,
                      2
                   )
                ),
                _Date2: 
                DateTimeValue(
                   Index(
                      _DT2,
                      2
                   ).Value & "/" & First(_DT2).Value & "/" & "20" & Last(_DT2).Value & " " & 
                   Mid(
                      Index(
                         SortedDates,
                         2
                      ).DateTime,
                      10,
                      2
                   ) & ":" & 
                   Right(
                      Index(
                         SortedDates,
                         2
                      ).DateTime,
                      2
                   )
                ),
                _Date3: 
                DateTimeValue(
                   Index(
                      _DT3,
                      2
                   ).Value & "/" & First(_DT3).Value & "/" & "20" & Last(_DT3).Value & " " & 
                   Mid(
                      Index(
                         SortedDates,
                         3
                      ).DateTime,
                      10,
                      2
                   ) & ":" & 
                   Right(
                      Index(
                         SortedDates,
                         3
                      ).DateTime,
                      2
                   )
                ),
                _Date4: 
                DateTimeValue(
                   Index(
                      _DT4,
                      2
                   ).Value & "/" & First(_DT4).Value & "/" & "20" & Last(_DT4).Value & " " & 
                   Mid(
                      Index(
                         SortedDates,
                         4
                      ).DateTime,
                      10,
                      2
                   ) & ":" & 
                   Right(
                      Index(
                         SortedDates,
                         4
                      ).DateTime,
                      2
                   )
                ),
                _Date5: 
                DateTimeValue(
                   Index(
                      _DT5,
                      2
                   ).Value & "/" & First(_DT5).Value & "/" & "20" & Last(_DT5).Value & " " & 
                   Mid(
                      Last(SortedDates).DateTime,
                      10,
                      2
                   ) & ":" & 
                   Right(
                      Last(SortedDates).DateTime,
                      2
                   )
                )
             },
             With(
                {
                   recordToSubmit: 
                   {
                      TimeRaised: _Date1,
                      TimeAssigned: _Date2,
                      TimeStarted: _Date3,
                      NotesAdded: _Date4,
                      TimeCompleted: _Date5
                   }
                },
                Patch(
                   'CRM Priority (Do Not Use)',
                   Defaults('CRM Priority (Do Not Use)'),
                   recordToSubmit,
                   Form1.Updates
                );
                Notify(
                   "All dates submitted successfully!",
                   NotificationType.Success
                );
                ResetForm(Form1);
                Reset(TextInput1)
             )
          )
       ),
       Notify(
          "Not enough dates to submit!",
          NotificationType.Error
       ) 
    );
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

     
  • AM-27101151-0 Profile Picture
    24 on at
     Thanks @WarrenBelz that perfectly worked
  • Verified answer
    WarrenBelz Profile Picture
    156,958 Most Valuable Professional on at
    Yep - all of that would not be necessary if . . .
     

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

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard