Templating the Date field
The Date field allows content writers to add a date that represents a calendar day.
Here's how to get the value of a Date field and output it in a simple format.
Copy
<span class="date">
${document.getDate("post.date").getValue()}
</span>
// Outputs in the following format: 2016-01-23
You can control the format of the date value by using asText() method and passing in the formatting options as shown below.
Copy
<span class="date">
${document.getDate("post.date").asText("EEEE MMMM dd, yyyy")}
</span>
// Outputs in the following format: Saturday January 23, 2016
For more formatting options, explore the Java documentation for date formatting options.