Thursday, September 25, 2008

How to insert a date

Update: 21 February 2011, 11:57:26 AM. Stop the press: forget these shortcuts.. just use an AutoHotkey script that will work for ALL programs! Insert a date into any program using Autohotkey on Windows.


Here is how to insert a date for the different programs that I have had to do this for so far. Feel free to tell me how to do it for programs you use that I haven't listed here. :)

  • Eclipse: edit a template to put the time stamp in a comment for example, as per this newsgroup post: Insert Date/Timestamp in comment. Or make a new template with just a time stamp in it, as per this alternate reply to the previous post.
  • JEdit: you need a script. Here is a script by Robert Schwenn to insert a date.
  • Microsoft Excel: press control+;.
  • Microsoft Word 2003 and earlier: Alt, I, T or from the menu bar, select Insert > Date and Time. I like being able to select the date format here. Note that if you check the "Update Automatically" box, the date will be "dynamic" i.e. it will update to the current date whenever someone selects the date (or does a select all in the document) and presses F9 - in Windows.
  • Notepad: F5
  • UltraEdit: press F7 and get a date like this: 25/09/2008 3:36:32 PM.
  • Vim: roll your own function. I use this one in my .vimrc: :inoremap <F5> <C-R>=strftime("%c")<CR>. Check out the vim wikia page Insert current date or time for more info.