I want to create list column that will show current time of an item. Not time when item was edited or created but current time and it should show time anytime (always).

  • 1
    How can an item have a current time? I haven't started drinking today, but probably I need a couple of pints to understand this :) – Paul Strupeikis Sep 23 '15 at 9:51
  • current time of computer or server. so current time to put in a list column in every item of that list. I maybe didn't make myself clear. Pardon me. – Danilo Sep 23 '15 at 9:54
  • Sorry for the joke. On topic: you won't be able to do that as column values are saved when item is saved. As far as I know - there is no way how to do that, except for a custom field maybe. Another question, WHY would you do that kind of thing? users can see current time one the lower right hand side corner of the screen :) – Paul Strupeikis Sep 23 '15 at 9:57
  • I need it for some other calculations. – Danilo Sep 23 '15 at 9:58
  • To set value to another auto-calculated column? So just use [Now] in the formula of that column. This seems like an "XY problem" to me. – Paul Strupeikis Sep 23 '15 at 10:02

You can use a calculated column for this. Set the return type to return as number.

Create a calculated column and add this formula:

="<img src='/_layouts/images/blank.gif' onload=""{"
&" var day=new Date();"
&" var n = day.getTime();"
&" this.parentNode.innerHTML= n;"

But this will give you milliseconds. You can get the hours / minutes / seconds with :


You can also use day.toTimeString().split(" ")[0]; to get the time string.

This will just be for display. You won't be able to use this for calculations though. I'll suggest doing the calculations in the calculated column itself.

Credits to Danny Engelman for all his work on calculated columns.

  • For me it's only showing <img src='/_layouts/images/blank.gif' onload="{ var day=new Date(); var n = day.getTime(); this.parentNode.innerHTML= n;}"> in the column..? – wheeler Sep 23 '15 at 10:29
  • 1
    You should return it as number. – Akhoy Sep 23 '15 at 10:30
  • How you mean do calculations in calculated column itself? Do you mean to make substraction (pr any other math. operation) in that column where I got miliseconds? – Danilo Sep 23 '15 at 10:50
  • 1
    Yes. That is what I meant. – Akhoy Sep 23 '15 at 10:54
  • Glad I could help :) – Akhoy Sep 23 '15 at 10:56

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.