Once a command is entered and numbered, as in In[n], and an output is produced, as in Out[n], is it possible to find the time at which each one was done?


1 Answer 1


You can use Cell | Show Expressionfrom the menu to see the time stamps associated with a cell. If you want to do this programmatically, you could use Cells and CurrentValue:

timeStamps[line_] := With[
    cells = Pick[
        CurrentValue[Cells[], CellLabel],

        CurrentValue[cells, CellLabel],
        DateString /@ Max /@ CurrentValue[cells, CellChangeTimes]

An example. Set the line number:

$Line = 1;

Then evaluate something:

2 + 2


Get time stamps:


<|"In[2]:=" -> "Tue 4 Dec 2018 19:49:43", "Out[2]=" -> "Tue 4 Dec 2018 19:49:43"|>

  • $\begingroup$ Unfortunately CellChangeTimes returns only editing times, not the evaluation time. It isn't correct to associate the last editing time with the time of assigning the In[_] label to input cell... $\endgroup$ Commented Feb 14, 2019 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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