I have a $date defined as "day of week, month day, year" ex: Tuesday, February 26, 2013
I don't know where $date is defined but I like to add the hour to this $date variable, or create a variable with the hour, do you know how can I put it in the .vm file?
Alternative solution that doesn't require additional dependency or code modification:
Combined from two other answers.
Velocity provides a DateTool class for formatting dates. You would need to put an instance of this class into your velocity context:
Then you could use a formatting command like:
to get something like
Tuesday, February 26, 2013 at 11AM
One of the backing Java classes must be putting it into the Context. If you want to format the date differently, you can do it in that class.
Another option would be to put the raw Date object into the context, then call methods in the Velocity template to format it. If need be you can pass Apache Commons DateUtils or another helper class to the template as well (see this answer).
From the documentation:
Hope that helps