Forum Discussion
Countdown to due date in SharePoint 365 list
- Jan 11, 2023
Hi kobi1991 ,
sure. This is SharePoint Json list formatting code that formats a column.
https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting
Got to you SharePoint View, select the header of your "Due Date" column and select "Column Settings->Format this Column"
Copy the Json Code here
You don't have to change the formula, as "@currentField" references to the selected Column.
Best Regards,
Sven
Hi Chawoo,
sure.
@currentField
refers to the column where the format is applied on. But you can refer other columns by their internal Name.
Given you have the column "Other Date Column" then you reference that as "[$OtherDateColumn]", so the formula becomes this
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if(floor((Number([$OtherDateColumn])-Number(Date((getMonth(@now)+1)+'.'+getDate(@now)+'.'+getYear(@now))))/(60*60*24*1000))>0,floor((Number([$OtherDateColumn])-Number(Date((getMonth(@now)+1)+'.'+getDate(@now)+'.'+getYear(@now))))/(60*60*24*1000))+' day(s) remaining','no days remaining')"
}
Now apply that to your other (Countdown) column.
Best Regards,
Sven
SvenSieverding Is it possible to leverage this same approach but list days and hours, as opposed to just days? Appreciate your advice.