Can $DateTime.Now.Year be used with NVelocity to display the current year?
Question
Sorry that this is kind of a lazy questions...
I'm curious if $DateTime.Now.Year can be used with NVelocity templates to show the current year? Or do I need to set a variable?
Solution
No, as far as I know NVelocity templates only work with objects set in the VelocityContext.
OTHER TIPS
But there is no problem with adding your custom objects to the context and then use them in the template.
_context = new VelocityContext();
_context.Put("your_key", your_object);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow