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.
Any help or guidance would be much appreciated.
What am I doing wrong?
Thank you
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 !