Feb 02 2021 01:24 AM - edited Feb 07 2021 11:40 PM
I am trying to create a list on Sharepoint to be used in Power Automate. My Excel list has the dates column formatted as date only and as yyyy/mm/dd:
When I create a new Sharepoint list from Excel, the import screen shows the dates correctly:
But when the list is created, it minuses one day from the day of each date:
So when I go to column settings and change to date only, I am still missing a day on each date. Why is this happening?
Even if I format my Excel dates as M/d/yyyy h:mm AM/PM which is how it appears in the sharepoint list, it still breaks and removes a day. A workaround is to create a calculated column with this formula:
=DATE(YEAR(Date),MONTH(Date),DAY(Date)+1)
but why should I have to do this?
Feb 08 2021 02:42 AM
This JSON in Column settings -> Format this column -> Advanced mode fixed the day issue:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=toLocaleDateString(@currentField)"
}
I guess this gave me an opportunity to learn about Date/Time fields.
Feb 08 2021 03:41 AM - edited Feb 08 2021 03:44 AM
Although the JSON corrects the way dates are displayed in my SharePoint list, Power Automate matches dates in my list minus one day against today's date. This is so confusing!
For example my SharePoint list has the items:
User1 with birthday date 2/8/1985
User2 with birthday date 2/9/1970
(dates are formatted as M/d/yyyy)
My flow has a Apply to each loop with this condition to find list dates with today's date:
formatDateTime(outputs('Compose'), 'M/d')
is equal to
formatDateTime(utcNow(),'M/d')
Feb 08 2021 04:03 AM
SolutionThis fixes the output but really ridiculous that I have to do this workaround.
formatDateTime(addDays(outputs('Compose'),1), 'M/d')
Nov 15 2021 10:33 AM
@rwittels was this
formatDateTime(addDays(outputs('Compose'),1), 'M/d')
something you entered within the JSON script area? I'm having the same issue, and I do not know where in the LIST you entered this for it to correct the missing date.
Nov 15 2021 10:59 AM
Nov 18 2021 11:36 AM
@rwittels I also faced the same issue and had to change dates in the source excel file before import to the SharePoint list
Nov 18 2021 11:45 PM
Feb 08 2021 04:03 AM
SolutionThis fixes the output but really ridiculous that I have to do this workaround.
formatDateTime(addDays(outputs('Compose'),1), 'M/d')