Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Answered

Power apps formula gives wrong dates on sharepoint

Posted on by 20
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
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Power apps formula gives wrong dates on sharepoint
    Yep - all of that would not be necessary if . . .
     
  • AM-27101151-0 Profile Picture
    AM-27101151-0 20 on at
    Power apps formula gives wrong dates on sharepoint
     Thanks @WarrenBelz that perfectly worked
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Power apps formula gives wrong dates on sharepoint
    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

     
  • Suggested answer
    AM-27101151-0 Profile Picture
    AM-27101151-0 20 on at
    Power apps formula gives wrong dates on sharepoint
    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 
  • WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Power apps formula gives wrong dates on sharepoint
    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 ?

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard