Last active
November 30, 2015 15:55
-
-
Save elindoorn/97d443ffaacd9bddc22a to your computer and use it in GitHub Desktop.
Format date in template (Liferay 6.2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($date = $dateTool.toDate("EEE, dd MMM yyyy hh:mm:ss Z", $reserved-article-modified-date.getData(), $localeUtil.getDefault())) | |
#set ($timeZone = $timeZoneUtil.getTimeZone($user.getTimeZoneId())) | |
#set ($dateTimeFormat = "EEEE d MMMM yyyy") | |
#set ($modifiedDate = $dateTool.format($dateTimeFormat, $date, $locale, $timeZone)) | |
$modifiedDate | |
Alternative to get a language specific format: | |
#set ($dateTimeFormat = $languageUtil.get($locale, "project-date-format")) | |
Then define project-data-format in the language files | |
Dutch: project-date-format=EEEE d MMMM yyyy | |
English: project-date-format=EEEE, MMMM d, yyyy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment