Question

I am creating a list whereby I want following function:

Current Day or Today - 2 days = Output Date

i.e.

23/12/2010 - 2 days = 21/12/2010

Is it possible to change the current dates dynamically also?

i.e. everyday the Current Day column automatically changes to the current date.

so on 24th December output will be

24/12/2010 - 2 days = 22/12/2010

How to do it?

Thanks! saumil

Was it helpful?

Solution

My colleague has written up the different ways to get this sort of countdown/count up display to work in SharePoint, including

  • JavaScript & CEWP
  • SharePoint Designer and DVWP
  • Visual Studio and custom code
  • 3rd party (disclaimer, one of the options is from my own company)

http://blog.pentalogic.net/2011/05/how-to-create-a-countdown-in-a-sharepoint-list/

OTHER TIPS

You can't use "volatile" functions like [Today] in calculated fields. The reason is that the values of calculated fields are only computed when the list item is created or updated, so unfortunately it is not possible to do what you require using a calculated field.

You can "trick" SharePoint into allowing a [Today] expression in a calculated field by temporarily creating a column called "Today", then modifying the expression, then removing the temporary column. This circumvents the syntax checker but doesn't remove the underlying problem, because the value won't get updated until the next time you modify that list item.

It should be possible to do this with custom XSLT in an XmlListViewWebPart, or its predecessor DataViewWebPart (as mentioned in another answer). You could also do this with custom code, of course.

There are kludgy workarounds for using [Today] in a calculated column, but they're really unnecessary, because [Today] in the context of a calculated column is the date the item is created.

Most likely, you'll want to use [Created]. If so, the calculation formula is pretty easy:

[Created]+2

HTH

Blessings, Jim Bob

Depending on your needs, you can do dynamic Date/Time math within a DVWP. You'll have to get comfortable with the date templates though. You can find a great post on this here: blogs.msdn.com/b/sharepointdesigner/archive/2008/02/25/filtering-and-formatting-with-date-values.aspx

If you have some q's about this, feel free to post back.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top