Small AutoHotkey script to insert date and time in various combinations from a few key strokes.

Note: I have only run this on Microsoft Windows 10

Why do you want this?

So many times it is useful to add a date / time stamp in text to any document you are writing in. This script makes it easy.

What does it do?

Key CombinationOutputExample
WIN + SHIFT + AYYYY-MM-DD HH:MM (Day)2020-03-11 15:57 (Wed)
WIN + SHIFT + SYYYY-MM-DD HH:MM2020-03-11 15:58
WIN + SHIFT + DYYYY-MM-DD 2020-03-11
WIN + SHIFT + FHH:MM15:59

How do I use it?

  1. Install AutoHotkey if you don’t how it all ready https://www.autohotkey.com/
  2. Download the script at the end of this page
    1. Or just review the text on this page and make your own
  3. Rename the script from a .txt file to .ahk file
  4. Double click on the script
  5. Try out the key combinations in a text file

The script

; Joshua Sutherland. 2020-03-11
; https://www.joshuasutherland.com/tools/insert-date-and-time-keyboard-shortcut/
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

; WIN+SHIFT+A to insert date, day and time e.g. 2020-03-11 15:40 (Wed)
#+a::
SendInput %A_YYYY%-%A_MM%-%A_DD% %A_Hour%:%A_Min% (%A_DDD%)
return

; WIN+SHIFT+S to insert date and time e.g. 2020-03-11 15:40
#+s::
SendInput %A_YYYY%-%A_MM%-%A_DD% %A_Hour%:%A_Min%
return

; WIN+SHIFT+D to insert date e.g. 2020-03-11
#+d::
SendInput %A_YYYY%-%A_MM%-%A_DD%
return

; WIN+SHIFT+F to insert the time e.g. 15:41
#+f::
SendInput %A_Hour%:%A_Min%
return