Forum Discussion
nshaw75
Jun 10, 2024Brass Contributor
Formatting Dates
In my SharePoint list I have a column of review dates. I was wanting to create a formatting formula which, I have tried using Co-Pilot to various levels of success I want the standard DD-MM-YY in the...
- Jun 12, 2024
nshaw75 format your date column in advanced mode with the following JSON:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField", "style": { "background-color": "=if(Number(@currentField) == 0, '', if(@currentField < @now, 'red', if(@currentField >= @now && @currentField < addDays(@now, 30), '#ffe577','white')))", "color": "=if(Number(@currentField) == 0, '', if(@currentField < @now, 'white', if(@currentField >= @now && @currentField < addDays(@now, 30), 'red','black')))", "font-weight": "=if(@currentField < @now, 'bold', 'normal')", "padding-left": "6px" } }Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)
Rob_Elliott
Jun 12, 2024Silver Contributor
nshaw75 format your date column in advanced mode with the following JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(Number(@currentField) == 0, '', if(@currentField < @now, 'red', if(@currentField >= @now && @currentField < addDays(@now, 30), '#ffe577','white')))",
"color": "=if(Number(@currentField) == 0, '', if(@currentField < @now, 'white', if(@currentField >= @now && @currentField < addDays(@now, 30), 'red','black')))",
"font-weight": "=if(@currentField < @now, 'bold', 'normal')",
"padding-left": "6px"
}
}
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)
- nshaw75Jun 12, 2024Brass ContributorHow would I change the Date format to DD/MM/YYY
I seemed to get that bit totally messed up now too 😢- Rob_ElliottJun 12, 2024Silver Contributor
nshaw75 make sure your regional settings are set correctly in Site Settings.
- nshaw75Jun 12, 2024Brass ContributorHi Rob, many thanks. That one was definitely a case of "I can't see the wood for the trees " 😄
- nshaw75Jun 12, 2024Brass ContributorThanks very much for the help. 😀