Here’s how to format a date inside a velocity template. Add an additional velocity-tools library in your dependencies:

<dependency>
     <groupId>org.apache.velocity</groupId>
     <artifactId>velocity-tools</artifactId>
     <version>2.0</version>
</dependency> 

Import the DateTool class:

import org.apache.velocity.tools.generic.DateTool;

Add an instance of this class to the VelocityContext:

VelocityContext context = new VelocityContext();
context.put("date", new DateTool());

Add your date object to the context:

context.put("some_date", new Date());

Use the DateTool parameter in the template to format date:

$date.format('dd.MM.yyyy', $some_date)