A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Use view formatting if the whole row should turn red, or column formatting if only the date cell should turn red.
For the entire row, in the list:
- Select All items or Switch view options.
- Select Format current view.
- Select Advanced mode.
- Paste this JSON and save:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$DueDate] <= @now + 15768000000, 'sp-field-severity--severeWarning', '')"
}
This applies a red warning style when the item date is within 6 months from now or earlier. Replace DueDate with the internal name of the date column if the column has a different name. If the column name contains spaces, use the internal-name format such as Due_x0020_Date.
For only the date column, use Column settings > Format this column > Advanced mode and paste:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if([$DueDate] <= @now + 15768000000, '#ff0000', '')",
"color": "=if([$DueDate] <= @now + 15768000000, 'white', '')"
}
}
Notes:
-
@nowis the current date/time when the list view loads. - SharePoint formatting supports date math by adding milliseconds to a date. Six months is approximated here as
15768000000milliseconds. - This changes only the display color, not the stored date value.