Keyboard shortcuts to enter current date/time

Was just coming to add a mention of espanso - https://espanso.org/

I’ve been creating templates for my daily entries, dates in my favorite format, etc.

4 Likes

I already have a autohotkey code running that allows me to generate time and date stamps with Alt+T, Alt+D respectively.
I use this in al of my note taking devices.

1 Like

I second this. I’m on Linux, and Autohotkey or similar functionality is outdated and/or missing on this platform.

If Plugin API would allow to setup new hotkeys there will be no problem to provide such a plugin, I believe. I saw what they even have MomentJS under the hood which gives more control over Date/Time.

1 Like

Check out espanso mentioned above… runs on Linux.

1 Like

Obsidian could take inspiration from the Discourse form for specifying a date/time (with the little calendar icon in the post editor). A benefit of this is that it’s machine-readable (and for the most part, human readable, especially when the WYSIWYG editor lands):

  • [date=2020-05-31 timezone="America/Los_Angeles"] -> 2020-05-31T07:00:00Z
  • [date=2020-06-01 time=17:00:00 timezone="America/Los_Angeles"] -> 2020-06-02T00:00:00Z
  • [date=2020-06-01 format="YYYY-MM-DD" timezone="America/Los_Angeles" timezones="UTC" recurring="1.weeks"] -> 2020-06-01

I don’t particularly care for the explicit timezone, but I can definitely see it’s value. It’d be extra awesome if Obsidian could parse something in the form - [ ] Important meeting [[date=2020-06-15 time=13:00:00]] and insert a link to the daily note for 2020-06-15. Extra brownie points if date/time objects can be inputted/displayed with natural language like Discourse does :grin:.

3 Likes

In the mean time, if you’re a windows user, here are my AutoHotKey scripts for text expanding dates. Change the shortcut to whatever works for you.

::ddtt::
FormatTime, Time, ,yyyy-MM-dd HH:mm
SendInput, %Time%
Return

::sddtt::
FormatTime, Time, ,yyyyMMdd_HHmm
SendInput, %Time%
Return

^!t::
::ddtts::
KeyWait Control, L  ; Wait for both Control and Alt to be released. (Required on Lenovo Yoga 14. Modifier keys would stay stuck and fuck shit up!)
KeyWait Alt, L
FormatTime, Time, ,yyyy-MM-dd HH:mm:ss
SendInput, %Time%
Return

::ddd::
FormatTime, Time, ,yyyy-MM-dd
SendInput, %Time%
Return

::dddd::
FormatTime, Time, ,yyyy-MM-dd dddd
SendInput, %Time%
Return

::sddd::
FormatTime, Time, ,yyyyMMdd
SendInput, %Time%
Return

::ttt::
FormatTime, Time, ,HH:mm:ss
SendInput, %Time%
Return

::ttm::
FormatTime, Time, ,HH:mm
SendInput, %Time%
Return
11 Likes

espanso is great. As a bonus you could create any keyboard shortcuts you wish. But yes it requires a little bit config work many end users might not be able to do. A default key for current date and current time + date as OneNote has might be needed.

4 Likes

Thank you. Just what the doctor ordered! :slight_smile:

1 Like

i definitely think this is something that should be in a text expander tool. that way i configure it once everywhere and not in each app. If you do need specific date formats per app, then most text expander tools should be able to accommodate that

1 Like

Sorry my reply is a bit late. Onenote has a feature like this, with alt+shift+d and alt+shift+t, respectively. Very useful, especially for a personal vault.

Personally I use textexpander as I realize I need to enter current datetime acros multiple apps

1 Like

It would also be super cool to have a full on date-picker shortcut since this would give you the ability to look at days of the week so that you can make notes to yourself that span in time.

For example, you could write something like #TODO [[date]] where the date can be selected using a date-picker UI. So you can help select the date “2 weeks from now” “2 days from now” etc. Roam Research has a similar feature.

5 Likes

for chinese user who use sogou pinyin input method, tab rq 日期, then select a time. Maybe other input method will support this feature too

I am stumbling on the same issue about the date. A text expander is working great obviously, but the date is entered as text. Wouldn’t it be better a date picker so that the date is entered as a field? I am thinking of possible searches and filtering in the future (pages from 2019 for example, pages from last month, etc).

Keep in mind that we are working in plain-text files, so the date is always going to be represented as text. What I think we want from a date-picker or any other input solution is consistency in date format.

The daily note plugin is the beginning of this. We set a date format for all daily note titles. That date format could be used consistently in all notes. Then future plugins that read dates (e.g. calendar) would know the date format to parse.

4 Likes

This is very handy.
I think a hot string (or text-expander) function can also help for the template like in this post.

All 3rd party solutions described here are nice, but you would think you don’t have to do this for such a simple yet essential feature. Many suggestions here are not accessible for new users (AutoHotKey script) or are Mac / PC specific.

1 Like

I’m just trying out the ‘Daily note’ plugin and I think it is annoying that I have to type today’s date all the time when I want to link to today. I’d love to have a shortcut (for me it probably would be Ctrl+D) that inserts the date.

The date should probably not be linked unless the shortcut is part of the Daily notes plugin.

3 Likes

Text expander? E.g. Espanso.

3 Likes