Wiki template date formatting: yy and day of year

For reasons that are too boring to go into, I want to add a custom date to the wiki link template. Is there a placeholder equivalent to ‘two digit date’ and ‘day of the year’?

e.g. Type [[This is the name of a new note]] and have a new note created with the name " This is the name of a new note"

It’s easy enough to get “202003022129” with %year%%month%%day%%hour%%minute%%, but I actually want 200622129 or “‘two digit year’ ‘day of year’ ‘hour’ ‘minute’”. Why? Because it’s shorter and I’m not going to be around when not giving the century to current notes will cause a problem…

Anyway, I know how to do this in a script by calling a shell script and date function, but is it possible in a Wiki template?

Also, as an aside, in DTTG both of the two date formats I’ve given above are automatically highlighted as telephone numbers for some reason. I can’t find a way of turning this off…

Thanks

There are no such placeholders yet, all available placeholders can be inserted via the Insert Placeholder submenu of the contextual menu.

Thanks, Christian.

I thought that might be the case, but wanted to check. I’ll see if I can fake it with Keyboard Maestro instead.

The short/medium/full date formats use the system-wide settings, by the way. See System Preferences > Language & Region > Advanced… > Dates. Customizing this might be an option too.

Hadn’t thought of that – thanks for the suggestion!

Just a wish:
Add month in number in DT dictionary. It seems that the current get month of (whatever date string) is returning the name of month (e.g. March) but there is no std command to convert string into integer (03). I don’t know about the others but for me it’s easier to order/manipulate fixed length date string 2020.03.03.11.13 rather than 2020.March.03.11.23.

Cheers

Scripting dates is not handled by DEVONthink on its own but this should work: return month of (current date) as integer

:grinning: :grinning: Another great tip! Thanks

From houthakker in this forum. Very handy for adding leading zero.

on PadNum(lngNum, lngDigits)
	set strNum to lngNum as string
	set lngGap to (lngDigits - (length of strNum))
	repeat while lngGap > 0
		set strNum to "0" & strNum
		set lngGap to lngGap - 1
	end repeat
	strNum
end PadNum

Here’s a much simpler version…

set dateMonth to month of docDate as integer
		if dateMonth < 10 then set dateMonth to ("0" & dateMonth)

From: Smart rule Date not Found

Very true! Month and day are never more that 2 digits.

Indeed :slight_smile: