Forums / Developer / extract the publish date

extract the publish date

Author Message

Sirvash Sharma

Thursday 11 May 2006 6:46:15 am

HI,
I have to fetch the publish date of news and i am using this code below.
but bydefault its shows the different date- wednesday 31 December 1969

{$node.data_map.news.published | l10n ('date') }

what's wrong with me please suggest me.
Thanks

Kristof Coomans

Thursday 11 May 2006 6:51:10 am

With you there's nothing wrong I guess ;-)

Try this:

{$node.object.published|l10n('date')}

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Łukasz Serwatka

Thursday 11 May 2006 6:59:48 am

Or if you want display date from your attribute (if exists) you can use:

{$node.object.data_map.date_attribute_id.content.timestamp|l10n(date)}

or

{attribute_view_gui attribute=$node.object.data_map.date_attribute_id}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Sirvash Sharma

Thursday 11 May 2006 7:49:30 am

Hi Kristof and Lukasz,
I have tryed that code but same view disply nothing change.

1- {$node.news.data_map.published|l10n('date')}
2- {$node.news.data_map.date_attribute_id.content.timestamp|l10n(date)}

both code given same result. any idea how to overcome this problem.
Thanks

Kristof Coomans

Thursday 11 May 2006 9:10:00 am

Which date do you want to show?
1) the date the object was published
or
2) a date stored in one of the object's attributes?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Sirvash Sharma

Friday 12 May 2006 12:43:13 am

Hi Kristof,
I wanna show the date of object publish date.and my object is news.
i just fetch the publish date of news.

Thanx

Kristof Coomans

Friday 12 May 2006 3:32:05 am

And in which template do you want to show it?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Sirvash Sharma

Friday 12 May 2006 4:30:42 am

Hi Kristof,
My template name is first_news.tpl which has been override by me. here i am using above code. in this template its shows the name of news but problem in case of publish date.

Thanx

Kristof Coomans

Friday 12 May 2006 6:21:33 am

And which template are you overriding with first_news.tpl?

And with which code do you display the name of the news?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Sirvash Sharma

Friday 12 May 2006 6:33:19 am

Hi kristof,
I am using override template ( first_news.tpl ). this template is overriding the folder.tpl.
and for display the name of first news using this code.

{$node.data_map.news.data_text}

Kristof Coomans

Friday 12 May 2006 7:09:10 am

And the news attribute, which datatype is it using?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Sirvash Sharma

Tuesday 16 May 2006 5:55:59 am

Hi kristof,
news attribut is using the date datatype.

Kristof Coomans

Tuesday 16 May 2006 6:33:55 am

I'm not sure if I understand you correctly, but you can try this:

{$node.object.data_map.news.content.timestamp|l10n(date)}

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Patrice DUCLAUD

Wednesday 17 May 2006 12:32:09 am

hello,

You can try this :

{$node.object.data_map.Your-date-attribute.data_int|l10n(date)}
or
{$node.object.data_map.Your-Date-attribute.data_int|ldatetime(custom,"%d/%m/%y")}

Patrice