# How can I insert the current date in a text cell? [closed]

Ok I must be missing something. I have a section with the "last updated date" in a text cell, I'd like it to autoupdate. Is there a "insert current date" command hidden away in some menu?

-

## closed as off-topic by m_goldberg, Kuba, Sjoerd C. de Vries, ciao, Oleksandr R.Apr 23 '14 at 0:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – m_goldberg, Kuba, Sjoerd C. de Vries, ciao, Oleksandr R.
If this question can be reworded to fit the rules in the help center, please edit the question.

When should it be updated? –  Kuba Apr 22 '14 at 15:28

If you want this done automatically then the way I would do it is to time stamp the notebook as you close it, i.e. the time stamp appears after "Last modified".

This code might be overkill but it will do the job:

Create a text cell with "Last Modified " in it and give it a cell tag (in this example "LastModified"), then ...

SetOptions[EvaluationNotebook[],
NotebookEventActions :> {"WindowClose" :>
Module[{dy, hr, mn}, {dy, hr, mn} =
Map[(LinkWrite[First[$FrontEnd], FrontEndValue[#]]; LinkRead[First[$FrontEnd]]) &, {"DateLong", "Hour",
"Minute"}]; NotebookLocate["LastModified"];
NotebookWrite[InputNotebook[],

message = DateString[DateList[]]  ;
`