How can I set the format for the ${date} variable which can be used in Eclipse templates?
相关问题
- Eclipse and Mylyn : how to disable grey files in t
- Date with SimpleDateFormat in Java
- Installing Pydev for Eclipse throws error
- Error in Scala Compiler: java.lang.AssertionError:
- How to remove unused imports using Eclipse and not
相关文章
- selenium+eclipse 打开网页时报错
- Eclipse failing to open
- Eclipse how can I indent C++ preprocessor macros
- Why is FindBugs ignoring my check for null?
- Eclipse cleanup - what are the “.index” files - ca
- MYSQL: How can I find 'last monday's date&
- Eclipse plugin to find out unused methods in a cla
- Spring NamespaceHandler issue when launching Maven
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:
${date}
${mydate:date}
${d:date('yyyy-MM-dd')}
${maDate:date('EEEE dd MMMM yyyy HH:mm:ss Z', 'fr')}
More info about this feature on my blog: Bug 75981 is fixed!
You could tell Eclipse to use a specific locale different from that of your operating system. Eclipse 3.5 (64 bit) doesn't use the MacOS X region setting. MacOS X english installation language with Germany as country provides a wrong date format.
You can fix it for your Eclipse installation when you append following lines to your eclipse.ini:
Update February 2016: bug 75981 is officially fixed!
See Jmini's answer below
Update July 2015, 6 years later:
The bug mentioned below seems fixed in Eclipse 4.x.
Eric Wang comments below:
Original Answer 2009 Eclipse 3.x
Argh! There is a long standing bug just for that: bug 75981
The only alternative would be to modify the class
SimpleTemplateVariableResolver
(as described in this thread), from the packageorg.eclipse.jface.text.templates
. (You have here an example of such an extension).This thread mentions the sources where you can find the class.
Example:
Additional information for those stumbling over this lately (like me):
For ISO 8601 date format, one can use the language settings fr-CA.