Templating the Timestamp field
The Timestamp field allows content writers to add a date and time.
Copy
@document["event.date"].value
The first way to display the Timestamp is to use the default format.
Here's an example that shows how to do this by simply outputting the Timestamp value.
Copy
<span>
<%= @document["event.date"].value %>
</span>
# Outputs in the following format: 2016-01-23 13:30:00 +0000
You can control the format of the Timestamp value by using strftime method as shown below.
Copy
<span class="event-date">
<%= @document["event.date"].value.strftime("%A %b %d, %I:%M %P") %>
</span>
# Outputs in the following format: Saturday Jan 23, 01:30 pm
For more formatting options, explore the Ruby documentation for the strftime method.