I am creating a list whereby I want following function:

Current Day or Today - 2 days = Output Date


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

  • Thx Friends! Does anyone a javascript solution to this issue?
    – neo269
    Dec 24, 2010 at 16:10
  • 1
    It would help if you describe what you are trying to do - then there may be alternatives.
    – Ryan
    Dec 24, 2010 at 17:01
  • I need a column which refreshes automatically to the current date. i.e. a Column shows date today, tomorrow date changes to tomorrow's date and so on without editing it.
    – neo269
    Dec 25, 2010 at 7:53

4 Answers 4


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)



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.

  • I've written a post about the [Today] trick that as you say doesn't work but seems to get bloged twice a month - blog.pentalogic.net/2008/11/…
    – Ryan
    Dec 24, 2010 at 17:03
  • Seriously, how does this stuff still get marked as answers? saumil, Please, I beg you to do your homework with the calculated [Today] trick. It simply is snake oil. Works once, but it'll never update, unless you update the item. It doesn't work!
    – iOnline247
    Dec 25, 2010 at 2:25
  • iOnline247, that's exactly what I explained in my answer.
    – SPDoctor
    Dec 26, 2010 at 10:23
  • I apologize. I must've read it too fast. Sorry for the confusion SPDoctor. I'm bumping your answer now b/c I've made such a goof.
    – iOnline247
    Dec 27, 2010 at 14:01
  • Okay, no problem.
    – SPDoctor
    Dec 27, 2010 at 19:35

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:



Blessings, Jim Bob

  • Slight clarification: [Today] is equivalent to [Created] in the calculated default value for a date/time field. In a calculated field (assuming you used the kludgy workarounds!), it is initially the same as [Created], but is updated whenever you edit the list item.
    – SPDoctor
    Dec 24, 2010 at 10:23

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.