NetBeans Code Templates ${date}?

Ari B picture Ari B · Aug 4, 2009 · Viewed 8.3k times · Source

I have this code template in Eclipse

@since ${date}

when entered i get something like this :

@since 4.8.2009

But when i add the same template (@since ${date}) to NetBeans it outputs

@since date

Can someone help ?

No answer yet ? Is this not possible in Netbeans ???

Answer

ollie314 picture ollie314 · Mar 14, 2012

Something like the following example should doing the job :

${date?date?string("yyyy")}.${date?date?string("MM")}.${date?date?string("dd")}
  • yyyy => year on 4 elements (ex: 2012)
  • MM => Month on 2 elements (ex: march -> 03)
  • dd => Day of the month on 2 elements (ex: 23)
  • . => separator you want to separate each fields (ex: - or / or . or smth else) You should have to check about available format somewhere in the netbeans help (sorry I don't find out informations about this for now). I see that's a very old post, but if it may usefull for someone ... regards. ollie314