Timer
- This topic has 3 replies, 2 voices, and was last updated 10 years ago by .
Viewing 3 reply threads
Viewing 3 reply threads
- You must be logged in to reply to this topic.
Home › Forums › General discussion › Timer
Hi There
I know this is an old age problem, but was looking to see if there was an update.
I have two columns:
Date Received
Date Due
I need another column that will do a countdown in realtime (not a solution that will required data to be update) to show the days remaining, such as 10 days left.
Any help would be appreciated.
Iain
Hi,
You can create a calculated column with this formula:
="<img src='/_layouts/images/blank.gif' onload='var a = new Date("&YEAR(DueDate)&","&(MONTH(DueDate)-1)&","&DAY(DueDate)&","&HOUR(DueDate)&");var b = new Date();var c = (a-b) / (1000*60*60*24);this.outerHTML = c<0?""<span style=color:red>OVERDUE</span>"":c<1?parseInt(c*24,10)+(c*24<2?"" hour"":"" hours""):parseInt(c,10)+(c<2?"" day"":"" days"")'>"
Change “DueDate” to match your field name.
You must set the “The data type returned from this formula is” to “Number (1, 1.0, 100)”. This renders the calculated value as HTML in list view, and this “trick” works in most list views in SharePoint, but will not work in the “New experience” list views in Office 365.
Please note that this column cannot be filtered as the filter value will be the HTML string.
The output will be as show in the attachment.
Hope you can use it,
Alexander
Excellent – many thanks Alexander. Saved the day again.
Iain
I’m glad it worked.
Alexander