Rich Text Format (RTF) - Creation Date & Time Stamp

Hello -

I would like to create a new Template for note taking that includes a document creation date & time stamp (i.e. a date that does not change). Is there a command that can be used to automatically do this within the template?

Thank You.

Welcome @Border27

Are you referring to a date and time stamp in the document’s contents?

Yes. When I create a doc, id like there to be a date/time stamp in the footer - of the date/time created.

I know this info is in the metadata.

I have searched the Community, but could not find the answer.

Thanks!

Wait for Jim’s answer, because I don’t know enough about the possibilities offered by templates in DT. But assuming you can’t do this via the template, you could set up a script in the toolbar which creates a new RTF document, and adds the appropriate data as content. I don’t think it would be possible to add it to the footer, though (do RTFs have defined footers?); but it could be added as the first line. If you wanted, the script could even ask for the title of the document and add that as the first line followed by the creation date & time.

It’s easily done with placeholders.

  1. Create a new rich text document.
  2. Add your boilerplate text.
  3. Where needed, Control-click > Insert Placeholder and add the date and time placeholders that apply to your situation. They will resolve to their raw values in the content, e.g., %hour%.
  4. When done, select File > Export > as Template, saving to the suggested location.
  5. It should now be available in the Data > New from Template menu.

2 Likes

Jim -

That is just great - solves my question. Thank you.

If I may ask one more question - is there a place where I can find all of the options for inserting items like date & time in an RTF? Like 12 hour time format. Items the follow the % item % format.

Thank you!

Page 226 of the manual is a good place to start.

Stephen

4 Likes

Stephen,

Yes, thank you for the reference to the manual,

My last question was related to the syntax used for the placeholders. For example:

%date% gets met April 18, 2021. But, what is the syntax to get 04/18/21?

Similarly, %hour% gets me a number between 1-24. How would I get a 12 hour version of this?

I’m looking for a library, list or cheat sheet with all of the % ____ % strings?

Hope that makes sense.

Thanks You!

For a specific date type, you can use the individual date placeholders, e.g., day/month/year, though that will not yield a 2 digit year.

There is a list in the Help > Documentation > Automation > Smart Templates section. This also has information on creating your own placeholders and using them via AppleScript in a smart template.

Jim - thank you again. The Template Placeholders is what I have been searching for!

1 Like

You’re welcome :slight_smile: