Forum Discussion
Formatting the date
- 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
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
- robrkhwMar 07, 2023Copper Contributor
ganeshsanap SvenSieverding Thanks to both of you - both methods work, i just prefer the way ganeshsanap code highlights the whole background.