{"id":9779,"date":"2019-06-15T06:11:42","date_gmt":"2019-06-15T00:41:42","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=9779"},"modified":"2023-08-02T20:35:47","modified_gmt":"2023-08-02T15:05:47","slug":"insert-date-time-in-any-program-using-keyboard-hotkey","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/insert-date-time-in-any-program-using-keyboard-hotkey\/","title":{"rendered":"Insert Date\/Time in Any Program Using Keyboard Hotkey"},"content":{"rendered":"<p>When you&#8217;re writing content such as technical content, news articles, etc., you may sometimes want to insert the current date or timestamp in a program or editor you&#8217;re using. In Notepad, you can add the timestamp by pressing the <kbd>F5<\/kbd> key.<\/p>\n<p>Microsoft Office Word, OneNote allows the <kbd>Alt<\/kbd> + <kbd>Shift<\/kbd> + <kbd>D<\/kbd> and <kbd>Alt<\/kbd> + <kbd>Shift<\/kbd> + <kbd>T<\/kbd> hotkey combinations to insert the current date and current time respectively.<\/p>\n<p>Similarly, WordPad has the <strong>Date and time<\/strong> toolbar button that lets you insert the date or timestamp in your preferred format from the list of 13 choices.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9782\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/wordpad-date-time-toolbar.png\" alt=\"insert date\/time in any program - wordpad\" width=\"464\" height=\"124\" \/><\/p>\n<p>But, if you&#8217;re using a program which doesn&#8217;t have a built-in feature to insert current date and time, you may need a third-party macro or automation tool for that purpose. With automation tools, you also have the advantage of using a single hotkey combination to insert the date or timestamp in any program.<!--more--><\/p>\n<h2>Insert date or time in any program using keyboard hotkey<\/h2>\n<p>AutoHotkey is a free, open-source scripting language for Windows that allows users to easily create small to complex scripts for all kinds of tasks such as form fillers, auto-clicking, macros, etc.<\/p>\n<ol>\n<li>Download <a href=\"https:\/\/www.autohotkey.com\/\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">AutoHotkey<\/a> and install it.<\/li>\n<li>Right-click on the desktop, click New and select <strong>AutoHotkey Script<\/strong>.<\/li>\n<li>Rename the script file <code>New AutoHotkey Script.ahk<\/code> to <code>insert_date.ahk<\/code><\/li>\n<li>Right-click the file and choose <strong>Edit Script<\/strong><\/li>\n<li>Remove all lines in the script and replace it with the following code:\n<pre>^!d::\r\n     FormatTime, CurrentDateTime,, hh:mm tt M\/dd\/yyyy\r\n     SendInput, %CurrentDateTime%\r\nreturn<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9784\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/autohotkey-script-editor.png\" alt=\"insert date\/time in any program - notepad .ahk editor\" width=\"701\" height=\"143\" \/><\/li>\n<li>Save the file <code>insert_date.ahk<\/code> and close the editor.<\/li>\n<li>Double-click to run the script. It will show up in the notification area.<\/li>\n<li>Now, switch to the program where you want to insert the date or timestamp.<\/li>\n<li>Press <kbd>Ctrl<\/kbd> + <kbd>Alt<\/kbd> + <kbd>D<\/kbd> to insert the timestamp at the current cursor position.<\/li>\n<\/ol>\n<h3>Script Customization<\/h3>\n<p>You can change the keyboard hotkey in the (1st line of the) script if you need. Here are the modifiers.<\/p>\n<ul>\n<li><code>!<\/code> \u2003 {Alt}<\/li>\n<li><code>+<\/code> \u2003 {Shift}<\/li>\n<li><code>^<\/code> \u2003 {Ctrl}<\/li>\n<li><code>#<\/code> \u2003 {Winkey}<\/li>\n<\/ul>\n<p>For example, for <kbd>Ctrl<\/kbd> + <kbd>Alt<\/kbd> + <kbd>Shift<\/kbd> + <kbd>D<\/kbd>, you&#8217;d use <strong><code>^!+d<\/code><\/strong>.<\/p>\n<p><em>For the full list of keys you can send or intercept, see AutoHotkey <a href=\"https:\/\/www.autohotkey.com\/docs\/commands\/Send.htm\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">SendInput<\/a> documentation<\/em><\/p>\n<h4>Without using hotkeys<\/h4>\n<p>If you want to insert the timestamp by typing a specific word &#8212; e.g., <code>td<\/code>, then edit the .ahk script and replace its contents with the following:<\/p>\n<pre>::td::\r\n     FormatTime, CurrentDateTime,, hh:mm tt M\/dd\/yyyy\r\n     SendInput, %CurrentDateTime%\r\nreturn<\/pre>\n<p>Now, type <code>td<\/code> (and followed by a space) in any program. The words <code>td<\/code> will be replaced by the current date\/timestamp. See this animation:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9786\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/autohotkey-insert-date-timestamp.gif\" alt=\"insert date\/time in any program\" width=\"692\" height=\"206\" \/><\/p>\n<p>Similarly, you can customize the Date or timestamp format.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9781\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/autohotkey-insert-date-time.png\" alt=\"insert date\/time in any program - autohotkey\" width=\"327\" height=\"202\" \/><\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Date format<\/strong><\/td>\n<td><strong>Result<\/strong><\/td>\n<\/tr>\n<tr>\n<td>hh:mm tt M\/dd\/yyyy<\/td>\n<td>11:26 AM 6\/15\/2019<\/td>\n<\/tr>\n<tr>\n<td>hh:mm tt MM\/dd\/yyyy<\/td>\n<td>11:26 AM 06\/15\/2019<\/td>\n<\/tr>\n<tr>\n<td>hh:mm:ss tt MM\/dd\/yyyy<\/td>\n<td>11:26:22 AM 06\/15\/2019<\/td>\n<\/tr>\n<tr>\n<td>HH:mm MM\/dd\/yyyy<\/td>\n<td>11:26 06\/15\/2019<\/td>\n<\/tr>\n<tr>\n<td>HH:mm MMM\/dd\/yyyy<\/td>\n<td>11:26 Jun\/15\/2019<\/td>\n<\/tr>\n<tr>\n<td>(no formatting)<\/td>\n<td>11:26 AM Saturday, June 15, 2019<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em>See <a href=\"https:\/\/www.autohotkey.com\/docs\/commands\/FormatTime.htm\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">FormatTime Syntax<\/a> AutoHotkey documentation for more information.<\/em><\/p>\n<p>The above AutoHotkey script uses merely <code>1.5 MB<\/code> of memory.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9780\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/autohotkey-taskmgr.png\" alt=\"autohotkey task manager memory cpu usage\" width=\"600\" height=\"173\" \/><\/p>\n<p>And you can even compile the .ahk script to a .exe file so that you don&#8217;t need to have the AutoHotkey program installed. This is especially helpful if you manage a lot of computers as part of your home or work network.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you&#8217;re writing content such as technical content, news articles, etc., you may sometimes want to insert the current date or timestamp in a program or editor you&#8217;re using. In Notepad, you can add the timestamp by pressing the F5 key. Microsoft Office Word, OneNote allows the Alt + Shift + D and Alt + &#8230; <a title=\"Insert Date\/Time in Any Program Using Keyboard Hotkey\" class=\"read-more\" href=\"https:\/\/www.winhelponline.com\/blog\/insert-date-time-in-any-program-using-keyboard-hotkey\/\" aria-label=\"Read more about Insert Date\/Time in Any Program Using Keyboard Hotkey\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6,7],"tags":[762],"class_list":["post-9779","post","type-post","status-publish","format-standard","hentry","category-utilities","category-windows","tag-autohotkey"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":18617,"url":"https:\/\/www.winhelponline.com\/blog\/open-file-folder-path-clipboard-using-shortcut\/","url_meta":{"origin":9779,"position":0},"title":"How to Open File or Folder Path from the Clipboard Using Shortcut","author":"Ramesh","date":"September 15, 2020","format":false,"excerpt":"Sometimes we may need to copy a file or folder path from your email or chat window to the clipboard, and open the file or folder manually. Most people open the file or folder by launching the Run dialog, pasting the path from the Clipboard, and clicking OK. If your\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"copy path to clipboard to Run dialog","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/09\/copy-path-clipboard-run-dialog.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":8806,"url":"https:\/\/www.winhelponline.com\/blog\/turn-off-monitor-shortcut-command-windows\/","url_meta":{"origin":9779,"position":1},"title":"Turn Off Monitor Using Shortcut or Command-line in Windows","author":"Ramesh","date":"April 23, 2019","format":false,"excerpt":"My new Samsung Curved monitor has the power button on the rear end, perhaps for aesthetic purposes. I have been using monitors that have controls on the front or underneath the bezel all these years. Now, with the new monitor, I find it a little bit inconvenient to reach out\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"controlmymonitor turn off primary monitor using desktop shortcut","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/04\/controlmymonitor.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/04\/controlmymonitor.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/04\/controlmymonitor.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":10584,"url":"https:\/\/www.winhelponline.com\/blog\/change-accessed-modified-created-file-date-timestamp-windows\/","url_meta":{"origin":9779,"position":2},"title":"How to Change File Date or Timestamp in Windows","author":"Ramesh","date":"August 3, 2019","format":false,"excerpt":"Windows maintains three different date\/timestamps for every file and folder. They are \"Date Created,\" \"Date Modified,\" and \"Date Accessed.\" You may have to change the modified, created, or last accessed timestamp of a file or folder in some situations. For instance, I had to change the timestamp of some files\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"attributes changer change file timestamp date","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/08\/change-timestamp-attribute-changer-1.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":9842,"url":"https:\/\/www.winhelponline.com\/blog\/open-command-prompt-current-folder-keyboard-shortcut\/","url_meta":{"origin":9779,"position":3},"title":"Open Command Prompt in Current Folder Using Keyboard Shortcut","author":"Ramesh","date":"June 19, 2019","format":false,"excerpt":"There are at least a couple of ways to open Command Prompt in the current folder path from a folder window. The two widely used options include running cmd.exe from the File Explorer address bar and using the Open Command window here option from the folder background context menu. But,\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"open command prompt in current folder - autohotkey","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/open-cmd-here-autohotkey-3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/open-cmd-here-autohotkey-3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/open-cmd-here-autohotkey-3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/06\/open-cmd-here-autohotkey-3.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1398,"url":"https:\/\/www.winhelponline.com\/blog\/windows-10-cmd-prompt-close-alt-f4-hotkey\/","url_meta":{"origin":9779,"position":4},"title":"Windows 10 Command Prompt Can Be Closed using ALT+F4 Hotkey","author":"Ramesh","date":"December 28, 2015","format":false,"excerpt":"The much useful ALT+F4 key sequence closes any application, but not the Command Prompt window. Users had to type exit or click the Close button to close the window. This is the case in earlier versions of Windows (up to Windows 8.1), but have you noticed that the Windows 10\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/archived2\/w10-cmd-alt-f4.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/archived2\/w10-cmd-alt-f4.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/archived2\/w10-cmd-alt-f4.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5100,"url":"https:\/\/www.winhelponline.com\/blog\/screenshot-portion-screen-windows-10-winkey-shift-s\/","url_meta":{"origin":9779,"position":5},"title":"Screenshot a Portion of the Screen in Windows 10\/11 [Winkey+Shift+S]","author":"Ramesh","date":"January 10, 2017","format":false,"excerpt":"Starting with the Windows 10 v1703 (also known as Creators Update), OneNote's popular screenshot feature has been made an Operating System feature -- you can capture a specific region of your screen to the clipboard using the Win + Shift + S shortcut key. Screenshot a Portion of the Screen\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"snipping tool save screenshots automatically","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/01\/snipping-tool-save-screenshots.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/01\/snipping-tool-save-screenshots.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2017\/01\/snipping-tool-save-screenshots.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/9779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=9779"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/9779\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=9779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=9779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=9779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}