0

I have a date coming through as 25/4/2022. I need it changed to 25/APRIL/2022. I have tried every combination of ?date('dd/mm/yyyy') / ?datetime('dd/mmm/yyyy') ?datetime(dd/mm/yyyy)?string('dd/mmm/yyyy') that I can think of but I keep getting teh same type of errors:

The string doesn't match the expected date/time/date-time format. The nested reason given follows: Unparseable date: "" ---- FTL stack trace ("~" means nesting-related)

What am I missing here?

Nadav Julius
  • 301
  • 2
  • 16

1 Answers1

1

You need to use a Java SimpleDateFormat pattern to format dates. If you want the month, use M (uppercase), as m (lowercase) is minutes in hour. For a full month, use MMMM. So, use:

${"25/April/2022"?date("dd/MMMM/yyyy")}

See also:

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • 1
    I think 4 `M`s ought to be be enough no? 3+ is text, 4+ is unabridged, but actually using more only makes sense with numbers to specify leading zeros (e.g. `yyyyyy` for `002021`). – Cimbali Jun 02 '21 at 06:27
  • It is one of the examples at the SimpleDateFormat doc. And I've tested it at https://try.freemarker.apache.org/ – although 4 also seems to work. – Jasper de Vries Jun 02 '21 at 06:29