Forum Discussion

Steve_Ray's avatar
Steve_Ray
Copper Contributor
May 04, 2022
Solved

Conditional Formatting Document Review Dates

Hi All,   I am reletavley new to using Sharepoint online and list and i have a listi need help with.   My list tracks a number of operational procedures which are required to be reviewed on a reg...
  • RobElliott's avatar
    May 04, 2022

    Steve_Ray you can do this by formatting the column, selecting advanced mode and adding the JSON below. Note that date comparisons in JSON are done in milliseconds and I use the converter at https://convertlive.com/u/convert/months/to/milliseconds#12

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "background-color": "=if(@currentField <@now , '#c00000', if(@currentField >@now && @currentField <@now+15552000000, 'orange',if(@currentField > @now+15552000000 && @currentField < @now+31557600000, 'teal',' ')))",
    	"color": "=if(@currentField <@now+31557600000, 'white','#363636')"
      }
    }

     

    The result is as follows:

     

    Rob
    Los Gallardos
    Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

     

     

     

Resources