You can access dates in medini analyze projects and have them appear in your report. To format dates, call the Date service and apply patterns and locales. Use the Java date and time patterns, such as 'YYYY MM', or use an ID for a predefined Java pattern. For more information about date and time patterns, see the Java API documentation.
Examples
Formatting a Date from a Timeline
You can access dates from a project's timeline. In the following example, the output is a list of all dates (start, end, duration) in the project timeline, formatted as specified.
{ m:for ms | pm::PMMilestone.allInstances() }
{ m:ms.anchorDate.format('YYYY-MM -> dd') }
{ m:endfor }Formatting a Date from a Checklist
This example takes a date object from a checklist and formats it with a predefined pattern and a locale.
{ m:myTask.checkDate.format(1, 'DE') }Formatting an Epoch Unix Timestamp Value
In this example, a Unix epoch timestamp value (in milliseconds) is first formatted to a long integer value, which is then formatted to a date, after which the custom date format is applied.
{ m:'1723736385000'.toLong().toDate().format('EEE dd MMM YYYY') }