How to set the Eclipse date variable format?

后端 未结 4 1610
北荒
北荒 2020-12-08 06:41

How can I set the format for the ${date} variable which can be used in Eclipse templates?

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 07:14

    I have fixed Bug 75981 with Eclipse Neon M5. You can download this Milestone Release here:

    http://www.eclipse.org/downloads/index-developer.php

    … or wait until June 2016 for the official Neon Release.

    Here a quick description of how it works:

    • As before you can use the date variable with no argument. Example: ${date}
    • You can use the variable with additional arguments. In this case you will need to name the variable (since you are not reusing the date somewhere else, the name of the variable doesn't matter). Example: ${mydate:date}
      • The first parameter is the date format. Example: ${d:date('yyyy-MM-dd')}
      • The second parameter is the locale. Example: ${maDate:date('EEEE dd MMMM yyyy HH:mm:ss Z', 'fr')}

    More info about this feature on my blog: Bug 75981 is fixed!

提交回复
热议问题