Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
sandeep tripathi
change the date format
November 10, 2011 1:53 AM
Answer

sandeep tripathi

Rank: Regular Member

Posts: 100

Join Date: October 19, 2011

Recent Posts

hi everyone
i need to change the date format which is display for meta tag in asset publisher from mm/dd/yy to dd/mm/yy . if any body has any idea how to change the date format pls help .

thanks in advance!
Ravi Kumar Gupta
RE: change the date format
November 10, 2011 2:04 AM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1303

Join Date: June 23, 2009

Recent Posts

Check
1 Format dateFormatDate = FastDateFormatFactoryUtil.getDate(locale, timeZone);

in tomcat-6.0.29\webapps\ROOT\html\portlet\asset_publisher\init.jsp

You can add your own date format. Check this link to know more http://exampledepot.com/egs/java.text/FormatDate.html
Jignesh Vachhani
RE: change the date format
November 10, 2011 2:07 AM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 785

Join Date: March 10, 2008

Recent Posts

you can also use JSTL
<fmt:formatDate pattern="yyyy-MM-dd" value="${yourdate}" />
Which is very simple to use .

-Jignesh
Dhrutika Vyas
RE: change the date format
November 10, 2011 2:35 AM
Answer

Dhrutika Vyas

Rank: Expert

Posts: 438

Join Date: February 9, 2009

Recent Posts

hi sandeep,

you can use SimpleDateFormat as well.
You need to create hook and make below change in asset_metadata.jspf.

SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

After adding this,you can change where ever you need to display "dd/mm/yyyy" format as below.
ex.
if (metadataFields.equals("create-date")) {
value = sdf.format(assetEntry.getCreateDate());
}

Regards,
Dhrutika
Sagar A Vyas
RE: change the date format
November 10, 2011 4:23 AM
Answer

Sagar A Vyas

Rank: Liferay Master

Posts: 657

Join Date: April 17, 2009

Recent Posts

sandeep tripathi:
hi everyone
i need to change the date format which is display for meta tag in asset publisher from mm/dd/yy to dd/mm/yy . if any body has any idea how to change the date format pls help .

thanks in advance!


Hi Sandeep,

For all format you can refer : http://www.roseindia.net/java/javadate/date-format.shtml

Thanks,
Sagar Vyas
sandeep tripathi
RE: change the date format
November 10, 2011 10:35 PM
Answer

sandeep tripathi

Rank: Regular Member

Posts: 100

Join Date: October 19, 2011

Recent Posts

hi everyone
thanks everyone my work is done i had just added in asset_metadata.jspf simple date format which i needed and apply to all the value .
thanks again Tchf .

regards
Sandeep
Christopher Jimenez
RE: change the date format
January 6, 2012 2:44 PM
Answer

Christopher Jimenez

Rank: New Member

Posts: 10

Join Date: December 23, 2011

Recent Posts

<liferay-ui:search-container-row className="com.test.model.model.Book"
keyProperty="bookId" modelVar="book" escapedModel="true">
<liferay-ui:search-container-column-text name="title"
value="<%= HtmlUtil.escape(book.getTitle(locale)) %>" />

<liferay-ui:search-container-column-text name="author-name"
property="authorName" />

<liferay-ui:search-container-column-text name="publication-date">
<fmt:formatDate pattern="yyyy-MM-dd" value="<%=book.getPublicationDate()%>" type="date" />
</liferay-ui:search-container-column-text>

....

I cant make this work =S I dont know what I've done wrong...
Neetu Mishra
RE: change the date format
August 9, 2012 12:08 AM
Answer

Neetu Mishra

Rank: Junior Member

Posts: 76

Join Date: May 21, 2012

Recent Posts

Thanks guys!!

I have used this way & It's workingemoticon

Dhrutika Parekh:

you can use SimpleDateFormat as well.
You need to create hook and make below change in asset_metadata.jspf.

SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

After adding this,you can change where ever you need to display "dd/mm/yyyy" format as below.
ex.
if (metadataFields.equals("create-date")) {
value = sdf.format(assetEntry.getCreateDate());
}



Regards,
Neetu
John Lewis
RE: change the date format
August 11, 2012 9:47 AM
Answer

John Lewis

Rank: New Member

Posts: 1

Join Date: August 11, 2012

Recent Posts

Dhrutika Parekh:
hi sandeep,

you can use SimpleDateFormat as well.
You need to create hook and make below change in asset_metadata.jspf.

SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

After adding this,you can change where ever you need to display "dd/mm/yyyy" format as below.
ex.
if (metadataFields.equals("create-date")) {
value = sdf.format(assetEntry.getCreateDate());
}

Regards,
Dhrutika


It's working for me, too
Thanks for your post

__________________
Fast Lane Commission
Hitoshi Ozawa
RE: change the date format
August 11, 2012 5:52 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Probably better to add definition to init-ext.jsp in html\portlet
Sagar A Vyas
RE: change the date format
August 12, 2012 2:19 AM
Answer

Sagar A Vyas

Rank: Liferay Master

Posts: 657

Join Date: April 17, 2009

Recent Posts

Hi Christopher,

I guess there should be some error in you console please verify it.

Or as an alternative you can directly put below code in your searchContainer and give one try with this.

1
2              <%
3            SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd");
4        %>
5
6        <liferay-ui:search-container-column-text name="order-date"
7            value="<%= dateFormat.format(book.getPublicationDate()) %>" />


Hope this work.

Thanks,
Sagar Vyas
Dhrutika Vyas
RE: change the date format
August 12, 2012 11:28 PM
Answer

Dhrutika Vyas

Rank: Expert

Posts: 438

Join Date: February 9, 2009

Recent Posts

Hi John,

Good to know that it helped you.emoticon

Thanks,
Dhrutika
Vaibhav Mittal
RE: change the date format
October 22, 2012 8:38 AM
Answer

Vaibhav Mittal

Rank: Junior Member

Posts: 54

Join Date: July 16, 2012

Recent Posts

What if we want to show format as 16th January 2012 instead of dd/mm/yyyy?

One more concern if we will create a hook then that format will get applicable to all the asset publisher in the portal (all sites). What if we want different format in different sites on the same portal?