2

Is there a way to make a column in a list that updates daily with the current date? If not what's the best way to do this? I was thinking of using the 'Lookup' field to link to the calendar that's on the site with no luck.

Alls I need is a column that always has the current date.

  • Somebody may propose alternate way of achieving your functional requirement. If you can explain what you are trying to achieve by this column with "Current Date". – Amit Tyagi Dec 4 '14 at 0:25
  • @AmitTyagi simply use it to calculate the number of days until a certain item has until expiration – PT_C Dec 4 '14 at 12:52
  • Can you mark your question as answered, It keeps popping up in the Unanswered list – Danny '365CSI' Engelman Aug 10 '15 at 11:06
1

Two options

  1. Create a timer job which runs daily and updates the list items
  2. Create a workflow which fires daily and updates the list items

Option 1 is straight forward and easy to implement. Option 2 don't require any deployment and you can use SharePoint Designer to achieve this, but building it is tricky.

  • I didn't know you could do that with workflows. I thought they has to be manually activated – PT_C Dec 3 '14 at 20:52
  • Yes it's possible, but tricky to implement – Amal Hashim Dec 3 '14 at 21:19
  • sharepoint.stackexchange.com/questions/15962/… explains how to set up a daily triggered workflow fairly accurately. – MAllen22842 Dec 4 '14 at 19:47
  • @AmalHashim is there a better way to do using another feature in 2010? – PT_C Dec 9 '14 at 13:51
  • @PT_C unfortunately no. There some be some process which goes and update this on a daily basis. – Amal Hashim Dec 9 '14 at 13:57
1

Create a calculate column and set formula to : NOW()

This will set the field daily to today date, and then use this in other calculated columns.

  • This wont work as calculated columns only update when the item is updated. To use this (in the way OP wants) you would have to have a workflow that updates the item each day (such as a simple toggle field). This would then force the calculated column to recalculate – Roland Dec 15 '16 at 0:46
0

other options:

  1. add Javascript to the view which updates the listitem using JSOM

and

  1. But maybe you do not even need to update the Item, and all you want is a "today" calculation in the View, which can also be achieved with either CSR/JSlink code (which is not available in 2010) but can be done using Javascript in a Calculated Column (in both 2010 and 2013)

see http://viewmaster365.com/#/How how the ViewMaster365 Tasks App functions; HTML/Javascript in a Calculated Column works in 2010 as well (the Tasks App is only for 2013)

option 1. won't work on Office365/SharePoint Online

option 2. is doable with SharePoint Designer Workflows and rely internally on Timer Jobs, but in practice not 100% reliable and you have to check every week or so your workflow is actually still running

0

The quick and dirty method is PowerShell and a scheduled task. Assuming your field is a date/time field. You can do any math you want in there as well. Just set it to run daily.

$web = Get-SPWeb <Web URL>
$list = $web.Lists["<List Name>"]

foreach ($item in $list.Items)
{
  $item["Current Date"] = Get-Date -format s;
  $item.Update();
}
0

Unfortunately calculated columns are calculated at the time they are filled in. Not each time the column is viewed. If you are, however, trying to do that calculation at the time the item is created you can use the following:

=TEXT([Modified],"mm-dd-yyyy hh:mm:ss")

A somewhat older but reliable article regarding time inside the calculated columns can be read here at http://blog.pentalogic.net/2008/11/truth-about-using-today-in-calculated-columns/ in addition to the information I provided above.

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.