Embed today() function in a Writer doc

Discuss the word processor
Post Reply
lennyg
Posts: 1
Joined: Fri Apr 20, 2018 5:55 pm

Embed today() function in a Writer doc

Post by lennyg »

I want to have the current date in a writer document, so that whenever I open the document, it will always have today's date. I'm trying to create a letter template, and need the current date when I create a new letter from the template.
Open Office version: AOO415m1(Build:9789) - Rev. 1817496 2017-12-11 17:25
Windows 10 operating system
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: embed today() function in a writer doc

Post by FJCC »

Use the menu Insert -> Fields -> Date to place a date in the document. Then right click on that date and select Fields. In the Select area of the dialog, change it from Date (fixed) to Date
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: embed today() function in a writer doc

Post by John_Ha »

lennyg wrote:I want to have the current date in a writer document, so that whenever I open the document, it will always have today's date. I'm trying to create a letter template, and need the current date when I create a new letter from the template.
Be aware that if you use Date, and create a letter on 20 April 2018 using the template, and then open the letter .odt file on 3 May, the letter will show 3 May which is not the date the letter was written.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
keme
Volunteer
Posts: 3704
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: Embed today() function in a Writer doc

Post by keme »

If you use the menu item Insert - Fields - Date, it will insert the Date (fixed) field. Normally, this is what you would want for a document date. The date when a letter was written is relevant, but the (later) date when you reopen it is usually not.

In your template the Date (fixed) field will not change, but always show as the date when the template was created. When you use the template to create a new letter, the field will display the creation date for that new letter.
Note: For this to work, you must save your template with the template filetype. If you (like most people I know) save your templates as standard documents, this will not work.
To edit properly saved templates, you need to right click them in an Explorer window and select Open. Double click in Explorer or Open from Writer will create a new document based on the template, so "save" will not be automatically redirected to your template.


If you change the field type from Date (fixed) to Date, it will always show current date. This makes sense for logs and other "live" documents, where printouts should display the current date. This complies verbatim with your request that "... whenever I open the document, it will always have today's date". For a letter template, this makes no sense to me, and I suspect that it is not what you meant.

You see the full selection of available fields if you go to Insert - Fields - Other ... In addition to the date fields in the Document category, you also find a few options if you select the DocInformation tab. The Created - Date from DocInformation seems to work exactly like the Date (fixed) in the Document category. Other dates can be inserted from the Last Printed and Modified groups.
Post Reply