Insert Date Format

I accumulate a lot of links and excerpts in RTF documents. And, often add the current date in text to represent when the items was found or add an original date from the source.

Edit>Insert>Date would be more useful if I could set its format to xx/xx/xxxx. Better yet, also enclose it in parens; e.g. (11/21/2009).

Any way to do this?

Sure, that can be done by customizing the medium Date format in System Preferences.

I prefer using the YYYYMMDD date format, because when I insert such dates in document Names they will sort properly by Name sort.

I just customized the Medium date format as a test, to add parentheses enclosing the date, with this result: (2009/11/21).

The keyboard shortcut in DEVONthink to insert this is Shift-Command-D.

Now I’ll revert to my own preferred format: 20091121.

Interestingly the actual pref pane is in the Language & Text preference, Formats tab.

That’s my preference as well (picked up ages ago when starting out with UNIX).

Is there a way of inserting the “medium” date in other non-DTPO documents? All I ever see are the short and long dates, no medium. I’ve had to alter the short to reflect my own preference of 2009_1121.

Haven’t checked uses of the ‘medium’ date format in other applications.

Attached is a picture of how I customized the short and medium date formats in System Preferences.

On Leopard, it’s on the (Customize…) sheet for Dates under the Formats tab of System Preferences > International.

I’ve been nervous to change that because of possible unwanted side effects with different apps.

So both short & medium are the same…

dates.png

I probably asked too quickly, plus not precisely.

I’m generally happy with the default settings in System Preferences and only want parentheses enclosing a date when inserting one after links and excerpts in RTF documents. Otherwise, I agree with you guys about the year-first format in filenames and avoiding unwanted side effects with unusual date formats in different apps.

Bill, thanks for the tip about making the short and medium date formats the same and about DTPO’s use of medium.

I investigated a little further and came up with another approach:

  1. use Automator, choose a Service template, and insert an Action for “Run Shell Script”

  2. add this script: ```

date +’(’%m/%d/%Y’)’ | tr -d ‘\n’ | pbcopy


3. set "Service receives" (dropdown menu at top) to "no input"

4. name and save the workflow (name will appear in Services menu)

5. System Preferences > Keyboard > Keyboard Shortcuts (tab) > Services (left column) and locate the name of workflow in the right column)

6. enter a hot key combination that will activate the Service

This hot key combination puts the formatted current date on the clipboard. Then a Command+v immediately after pastes it into the document keeping the current style. This is very quick in practice using two successive hot key combinations. The technique is not limited to DTPO and works with any application supporting the new Service.

I also tried a similar, but all-in-one approach, using an Action to "Run Applescript" using this script:

do shell script “date +’(’%m/%d/%Y’)’ | tr -d ‘\n’ | pbcopy”
delay 0.3 --delay needed for reliability
tell application “System Events”
keystroke “v” using (command down)
end tell

One hot key combination is all that's needed this way, but I need to try it for a while.  I'm not confident in its reliability.