cancel
Showing results for 
Search instead for 
Did you mean: 

Configure of relative date format

junminya
Champ on-the-rise
Champ on-the-rise
Hi, everyone.

Can I do change date format to mm/dd/yyyy?

Now, it displays file timestamp " xxx days ago by yyy" in share repository screen.
My requests is changing timestamp format to mm/dd/yyyy.

>> added 2013/10/19 13:00

We could find define of date format in common.properties.
But can not change relative date format.

Do you know how to change relative date format to mm/dd/yyyy?

thank you.
4 REPLIES 4

niketapatel
Star Contributor
Star Contributor
Hi juminya

I think, you can't change date format in Repository screen directly from configuration!

You can define your any new date format in common.properties and this new date format you can use in Share client side js in Alfresco.util.formatDate() function

Ex: 
 Alfresco.util.formatDate(DateObject, Alfresco.util.message("date-format.shortDate")); 


To change dateformat in document listing page, Please use your new dateFormat in this file. Currently its using relativeTime -  webapps\share\components\documentlibrary\documentlist.js


Hope this help!

kaynezhang
World-Class Innovator
World-Class Innovator
The quickest way is to modify file
 ${SHARE_ROOT}\js\alfresco\renderers\i18n\Date.properties
and
 components\documentlibrary\documentlist-min.js

in file documentlist-min.js search with keyword "relativeTime",you'll find something like
aa=Alfresco.util.relativeTime 
,aa is a javascript function that convert iso8601 time format to relative time ,then search with keyword "aa(" ,you'll find something like
this.msg("details."+a5+"-by",aa(a7)
change this piece of code to

this.msg("details."+a5+"-by",a7
,and save the file.
You'll get what you want.

The best way is to use Surf component extension,but it'll take you more time and efford.

srikanth94
Confirmed Champ
Confirmed Champ

We need to edit the <alfresco home>\tomcat\webapps\share\WEB-INF\classes\alfresco\messages\common.properties as well as <alfresco home>\tomcat\webapps\share\WEB-INF\classes\alfresco\messages\common_en.properties 

the second file the locale specific file should also be modified.

## Date Formats
#Used client side (uses Alfresco.util.formatDate)
date-format.default=mm/dd/yyyy

These changes only impact the display format of date, if we need to make changes for form we need to modify in <alfresco home>\tomcat\shared\classes\alfresco\web-extension\site-webscripts\org\alfresco\components\form\form.get_en.properties and form.get.properties.

Hope this will help you Smiley Happy

afaust
Legendary Innovator
Legendary Innovator

Ideally, you should never edit any of the default files and instead use extension methods (e.g. Surf Extensibility Module with a i18n customisation bundle) to add any overrides via custom files.