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
Hi there, I appreciate your help on this and I can confirm it works. Previously to this solution I had two further columns - Daily Rate and Total Hire Cost, and the formula for these no longer work with the new solution. Are we able to make it so we can calculate the days in hire X daily rate to produce total hire cost, while keeping your solution in play as well?
I'd appreciate your help 🙂