Skip to main content



      Home
Home » Newcomers » Newcomers » Code Templates - Date formatting
Code Templates - Date formatting [message #255268] Fri, 02 May 2008 02:04 Go to next message
Eclipse UserFriend
Originally posted by: groups.pellaton.li

Hi

The code templates offer both a ${year} and a ${date} token. I am
missing either a ${month} and ${day} token or a possibility to pass
along a format string like "YYYYMMDD" to ${date}.

The result I am looking for:

// FIXME ${year}${month}${day} ${username}: ${comment}

// FIXME 20080502 johnsmith: bla bla bla

However, as ${date} is formatted using the default format of the Locale,
I get:

// FIXME May 2, 2008 johnsmith: bla bla bla


Any hints or ideas?

Michael Pellaton
Re: Code Templates - Date formatting [message #255281 is a reply to message #255268] Fri, 02 May 2008 04:13 Go to previous messageGo to next message
Eclipse UserFriend
Michael Pellaton wrote:
> Hi
>
> The code templates offer both a ${year} and a ${date} token. I am
> missing either a ${month} and ${day} token or a possibility to pass
> along a format string like "YYYYMMDD" to ${date}.
>
> The result I am looking for:
>
> // FIXME ${year}${month}${day} ${username}: ${comment}
>
> // FIXME 20080502 johnsmith: bla bla bla
>
> However, as ${date} is formatted using the default format of the Locale,
> I get:
>
> // FIXME May 2, 2008 johnsmith: bla bla bla
>
>
> Any hints or ideas?
>
> Michael Pellaton

You can contribute your own variable resolver.
See extension point "org.eclipse.ui.editors.templates"
http://help.eclipse.org/help33/topic/org.eclipse.platform.do c.isv/reference/extension-points/org_eclipse_ui_editors_temp lates.html

HTH
--
Anton Leherbauer
Wind River CDT Team, Austria
Re: Code Templates - Date formatting [message #255331 is a reply to message #255281] Fri, 02 May 2008 09:03 Go to previous message
Eclipse UserFriend
Originally posted by: groups.pellaton.li

Hello

Thanks for the hint.

In the meantime I found a Bugzilla issue that deals with exactly
my issue:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=75981

Thanks

Michael Pellaton
Previous Topic:Can't Trigger Databinding Validation on New Object
Next Topic:Auto execute a script before running an application within eclipse
Goto Forum:
  


Current Time: Mon May 12 12:55:53 EDT 2025

Powered by FUDForum. Page generated in 0.10211 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top