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"?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,657 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,673 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yanli Jiang - MSFT 21,611 Reputation points Microsoft Vendor
    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.