Is there a shortcut for inserting date/time in IntelliJ IDEA?

You can create your own:

  1. In Settings, go to Live Templates
  2. Add a new template with the abbreviation “date”
  3. For “template text”, specify $date$. Now the “Edit Variables” button should be enabled.
  4. Edit the variables, and set $date$ to use the expression date().
  5. Enable “Java comment” under the template’s context and click OK.

Now when you type “date” and use the default completion gesture (Tab), it will replace “date” with the current date.

You can also make use of the time() expression. Note that it doesn’t seem like IntelliJ has great support for specifying the format of this date.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)