This project has moved and is read-only. For the latest updates, please go here.

Add Timespan to DateTime Column

Jan 11, 2012 at 4:47 PM


I want to increase and decrease a DateTime column from a specific list with jquery and SPServices.

Normaly I should first receive the original datatime and then add the timespan and after that save it. But its too much I think. Is there a better possibility to add a timespan like 5 minuts to a datetime column adhoc?

Best Regards


Jan 11, 2012 at 9:02 PM
Edited Jan 12, 2012 at 2:11 PM


I'm not sure that there's a shortcut for you. You need to know the current value to add the timespan, right? If the date/time isn't in the page somewhere, then you'll need to do a GetListItems to get the item, parse out the column you want to change, do the date/time match, and then UpdateListItems to write the results back to the list.


Jan 12, 2012 at 7:06 AM

Hi Sympmarc,

thx for your answer, this was exactly what I wanted to avoid, but when there is no other possibility I have to do it like that. Maybe I find a another solution, but then I will post it here :)

Thx, best regards


Jan 12, 2012 at 2:11 PM


If you come up with a way to work magic, I'd certainly love to hear about it!


Jan 12, 2012 at 4:47 PM

Jan, I think you also posted the question on Stackexchange, and my reply was that calculated columns or workflows could be a better answer.

To expand on this: you could have 3 columns:

  1. Your original DateTime column
  2. a Timespan column
  3. a calculated column that does DateTime+Timespan

Then you could use SPServices to update Timespan, and the calculated column would automatically store the result. No need to grab the original DateTime value.

This might not work for your specific scenario, but based on the info you provided it seems like a reasonable solution.