Sameera De Silva
1 min readApr 29, 2022

How to add Author, Date, Time automatically when class is created in IntelliJ IDEA

Copy this .

/**
* Author: Sameera De Silva
* User:${USER}
* Date:${DATE}
* Time:${TIME}
*/

In IntelliJ IDEA, File >Settings > File and Code Templates>, select Class, and paste it .

They have provided a list of standard variables that they support.

Predefined variables take the following values:

${PACKAGE_NAME}
Name of the package in which a new class is created
${NAME}
Name of the new class specified by you in the Create New Class dialog
${USER}
System login name of the current user
${DATE}
Current system date
${TIME}
Current system time
${YEAR}
Current year
${MONTH}
Current month
${MONTH_NAME_SHORT}
First 3 letters of the current month name (Jan, Feb, and so on)
${MONTH_NAME_FULL}
Full name of the current month (January, February, and so on)
${DAY}
Current day of the month
${HOUR}
Current hour
${MINUTE}
Current minute
${PROJECT_NAME}
Name of the current project

Then create a new class, the tag is automatically created.

/**
* Author: Sameera De Silva
* User:jdoe
* Date:4/29/2022
* Time:11:30 AM
*/

package com.sam.testdata;

public class Animal {
}

Due to security issues , some companies discourage adding username , so in that case remove ${USER}.

Original content-https://www.youtube.com/watch?v=OVFbwibCAHw&ab_channel=CodeWithArjun

No responses yet