How to get the day (ex: Monday) from a time Instant in FreeMarker

So I got this Instant date in Java: “2018-05-19T22:00:00Z”.

How can I get the day of the week? like monday..

I was trying this but it doesn’t work:




Freemarker does not work with Instant, so you would need to convert that to string in Java (something like “2018-05-19T22:00:00Z”) and then convert the string doing the following:

<#setting locale="en_US">

First convert the string to datetime in iso format, and then back again to string with the pattern of your choosing.

By changing the locale setting, you may get the day of the week in different languages.

I think that the best way to work in Freemarker is to always have strings or integers variables.

Leave a Reply

Your email address will not be published. Required fields are marked *