Forum Discussion
Adding 1 everyday to a sharepoint list column
- Aug 04, 2023
Hi NathanAlex,
do you really want to have a column that contains the number of days since the hire date or do you just want to display the number of days?
You can do the latter quite easily, if you apply the following JSON formatting on your "Hire Instated" column:{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "style": { "display": "block" }, "children": [ { "elmType": "div", "txtContent": "=@currentField.displayValue" }, { "elmType": "div", "txtContent": "=floor((Number(Date((getMonth(@now)+1)+'.'+getDate(@now)+'.'+getYear(@now)))-Number(@currentField))/(60*60*24*1000))+' day(s)'" } ] }
This would look like this
Just select the little arrow down next to your column name and select "Column Settings"->"Format this column". Then switch to "Advanced mode" and paste that JSON into the editor.
Best Regards,
Sven
Hi NathanAlex,
do you really want to have a column that contains the number of days since the hire date or do you just want to display the number of days?
You can do the latter quite easily, if you apply the following JSON formatting on your "Hire Instated" column:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"display": "block"
},
"children": [
{
"elmType": "div",
"txtContent": "=@currentField.displayValue"
},
{
"elmType": "div",
"txtContent": "=floor((Number(Date((getMonth(@now)+1)+'.'+getDate(@now)+'.'+getYear(@now)))-Number(@currentField))/(60*60*24*1000))+' day(s)'"
}
]
}
This would look like this
Just select the little arrow down next to your column name and select "Column Settings"->"Format this column". Then switch to "Advanced mode" and paste that JSON into the editor.
Best Regards,
Sven
Pretty cool solution! 🙂
Just one remark.
"txtContent": "=@currentField.displayValue"
doesn't work for me
"txtContent": "@currentField.displayValue"
is working