This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Trying to create a PHP template in NetBeans 6.9.1 for a Copyright of the current year using Copyright ${date?string("yyyy")} or <#setting short="yyyy"> Copyright ${date?string.short} Both return an error: Expected method. date?string evaluated instead to freemarker.template.SimpleScalar From Daniel Dekany with FreeMarker The problem is most certainly that that the value of the "date" variable is not a java.util.Date (or a TemplateDateModel), but a string. That's the mistake of NetBeans... they should use a java.util.Date for a date, not a java.lang.String. Anyway, since it's a string, you can get a sub-string of it to extract the year, like ${date[0..3]}. (Or, you can cast it to date and then back to string with ${date?date('someFormatPattern')?string('yyyy')} where someFormatPattern is whatever format NetBean uses for that variable.)
I am slightly afraid to just change the type. But I may add a "time" variable that would be of type Date.
What about a new DateTime type or something, which might be a little more clear than your Time, as I believe Time should also be a Java Time object?
Created attachment 101912 [details] Introducing "dateTime" variable of type java.util.Date
Actually both "time" and "date" variables are already defined as strings. Thus the patch introduces new "dateTime". I'll integrate tomorrow, unless there are objections.
core-main#70b00b618bf4
Integrated into 'main-golden', will be available in build *201009090000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/70b00b618bf4 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #189843: Introducing 'dateTime' variable for all templating engines creating from DataObject templates