Search code examples
javaformattingformatjavadoc

How to insert creation date in JavaDoc


What is the best way to insert the date of the creation of a class in JavaDoc? Some examples:

Below the author tag with the string "created on"

/**
 * Class description
 *
 * @author Author Name
 * created on 2015/04/01
 */
public class ClassName() {
...
}

Below the author tag with the string "Date:"

/**
 * Class description
 *
 * @author Author Name
 * Date:   2015/04/01
 */
public class ClassName() {
...
}

With a non-existent @date tag

/**
 * Class description
 *
 * @author Author Name
 * @date   2015/04/01
 */
public class ClassName() {
...
}

Other...

And eventually, what is the best date format?

April 1, 2015
2015/04/01
...

Solution

  • Most IDE's have a mechanism to define templates to use when creating new classes. The current date can usually be inserted as part of the template.

    For example, here is the documentation for eclipse and this page shows the variables which can be used in templates.