Forum Discussion

robrkhw's avatar
robrkhw
Copper Contributor
Mar 07, 2023
Solved

Formatting the date

Hi   I have a column called "Last Reviewed / Updated" which is a date field - i would like to highlight just the field red and have the text white and bold to indicate that 7 days has passed since ...
  • ganeshsanap's avatar
    Mar 07, 2023

    robrkhw Use this JSON column formatting for your date column: 

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "style": {
        "color": "=if(Number(@currentField) != 0 && addDays(@currentField,7) < @now, 'white', '')",
        "background-color": "=if(Number(@currentField) != 0 && addDays(@currentField,7) < @now, 'red', '')",
        "font-weight": "=if(Number(@currentField) != 0 && addDays(@currentField,7) < @now, 'bold', '')",
        "padding-left": "10px"
      },
      "txtContent": "=@currentField"
    }

     

    Output


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

    For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs