A simple way to insert a timestamp?

I searched in many places for a simple way to insert a timestamp in any tiddler that I have open for editing.

I have the Shiraz Formatter subplugin installed in myTiddlyWiki Node.js edition and I tried to do something with the Snippets button, but it was not successful.

The best I could do was to create a snippet using with text <<now “YYYY-0MM-0DD 0hh:0mm ddd”>>.
I paste it in my tiddler and then I copy + paste the rendered timestamp in my editor area and I delete the <<now “YYYY-0MM-0DD 0hh:0mm ddd”>> text.

It works, but it’s not very fluid.

The implementation I have (button in the editor toolbar, and hotkey (I use ctrl-d because it’s my tomboy/gnote muscle memory) is based off the thread linked below, though I simplified it a little - removing all the “signature” stuff and just making it about timestamps

\define date-stamp() $(datetime)$

<$vars datetime=<<now "@@.date ddd DD mmm YYYY 0hh:0mm:0ss@@">> >
<$action-sendmessage
	$message="tm-edit-text-operation"
	$param="insert-text"
	text=<<date-stamp>>
/>

</$vars>

and I have a css .date block to taste.

Otherwise, I think I followed the info in this thread:

Result is that in the editor, a ctrl-d gives me this:

2025-09-30T23:18:17_f9e4afc2

2 Likes

I think I must pivot here.

I cannot find a practical way to add a button to the text editing toolbar. The one with bold, italics etc. buttons. It’s been impossible even on an empty single file HTML TiddlyWiki. Very frustrating.

the solution in the linked thread adds an icon to the editing toolbar. The key bit is this:

Tag it with $:/tags/EditorToolbar

And the various tags (condition, description, icon, etc) control various aspects of the toolbar icon (condition sets which tid types it appears for. description sets the tooltip, and so on (I am not qualified enough to say what the absolute minimum set of fields are)

Thank you for your help. I’m at a dead end. :woozy_face:

sometimes it’s just a matter of that first few steps and things start to fall in place.

Here is my date-stamp tid - just tested and this alone will add the button to the toolbar

caption: date-stamp
condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]]
description: Insert date-stamp
icon: $:/core/images/timestamp-on
list-before: $:/core/ui/EditorToolbar/stamp
shortcuts: ((date-stamp))
tags: $:/tags/EditorToolbar
title: $:/_/date-stamp
type: text/vnd.tiddlywiki

\define date-stamp() $(datetime)$

<$vars datetime=<<now "@@.date ddd DD mmm YYYY 0hh:0mm:0ss@@">> >
<$action-sendmessage
        $message="tm-edit-text-operation"
        $param="insert-text"
        text=<<date-stamp>>
/>
</$vars>

<!-- based on here https://talk.tiddlywiki.org/t/an-editor-toolbar-button-to-insert-user-signature-with-timestamp/1949 -->

Then to have a keyboard shortcut, create $:/config/shortcuts/date-stamp with the content describing the hotkey you want. Mine simply has the content ctrl-d, with no tags, no other fields.

Once the keyboard shortcut is there, then it can also be seen in the Control Panel. (occurs to me that it should be visible there as soon as it’s defined in the “shortcuts” tag of the initial tid, but that’s outside the scope of answering you here)

1 Like

Thank you. I’ll try it tomorrow!

2 Likes

perhaps this will help a bit

I actually implement this outside of Tiddlywiki. For example, in Ubuntu go to Settings → Keyboard → Keyboard Shortcuts → Custom Shortcuts. I bind the f5 function key to this command, so while editing, pressing f5 will output the timestamp. Presumably for each OS there are options for this, or even on mobile via keyboard shortcuts.

bash -c "date '+%Y-%m-%d %H:%M:%S' | tr -d '\n' | xclip -selection c"

The benefit with this approach is this is available to other programs too. But yes, if you are happy with a Tiddlywiki UI button, that keeps things easy. I don’t enable the UI toolbar so my approach works here.

Thank you for the suggestion. I use TUXEDO OS with KDE Plasma so this should work, but I would have to install xclip.

I learned something new today. :slightly_smiling_face:

I didn’t make it clear, but after you run this command (say via pressing f5 as in my example), the clipboard now has the timestamp value, so you are free to paste its value (ie, control-V) to put it into Tiddlywiki’s text input.