Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Incorrect date conversion

(0) ShareShare
ReportReport
Posted on by 149

Hi,

I have a SP List in which the date and time are stored as text string:

 

dd/mm/yyyy hh:mm

 

I am using AddColumn in a collect statement to convert this text string to DateTimeValue

 

ClearCollect(colB,Sort(AddColumns(MA_Timetable_2,"START",DateTimeValue(EventStart),"END",DateTimeValue(EventEnd)),ID,Ascending))

 

The problem is the date is being converted incorrectly.

 

Mo_Islam_1-1603410949596.png

 

Any help or guidance would be much appreciated.

 

What am I doing wrong?

 

Thank you

Categories:
  • Verified answer
    CU-18081211-6 Profile Picture
    CU-18081211-6 9,261 on at
    Re: Incorrect date conversion

    Hi @Mo_Islam ,

    You are using a "dd/mm/yyyy" system to collect your data as text in SharePoint and DateTimeValue recognized datetime type implicit in "mm/dd/yyyy". That why the conversion gives a datetime value where your day is recognized as month (because is greater that 12 it add a year and give you the remaining month), and your month is recognized as day.

     

    In other words to solve your problem, you have to set language_code parameter of function DateTimeValue to one similar to your data format saved in Sharepoint (i think "fr").

     

    Your new formula is: 

    ClearCollect(colB,Sort(AddColumns(MA_Timetable_2,"START",DateTimeValue(EventStart,"fr"),"END",DateTimeValue(EventEnd,"fr")),ID,Ascending))

    and should working fine.

     

    Hope it helps ! 

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard