About In the conditional formatting of a SharePoint list

R N 0 Reputation points
2024-04-08T18:39:10.95+00:00

In the conditional formatting of a SharePoint list, how can I make JASON a condition that "column (date)" is "equal" to "tomorrow"?

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Yanli Jiang - MSFT 31,611 Reputation points Microsoft External Staff
    2024-04-09T06:34:03.1766667+00:00

    Hi @R N ,

    This is accomplished using date math. You can add milliseconds to any date and the result will be a new date. For example, to add a day to a date, you'd add (246060*1000 = 86,400,000).

    Here's the expression syntax using Excel style:

    {
       "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
       "elmType": "div",
       "txtContent": "@currentField",
       "style": {
          "color": "=if([$DueDate] <= @now + 86400000, '#ff0000', '')"
       }
    }
    

    For more information, please refer to:

    https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#formatting-items-based-on-arbitrary-dates-advanced


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.