Forums / Developer / Formatting the date

Formatting the date

Author Message

Stéphane Bullier

Friday 27 May 2005 7:31:33 am

Hello,

I have a problem with formatting the date of publication of the news. I've created an attribute "date_publication".

In the template to manage posting, I have the following line: {attribute_view_gui attribute=$node.object.data_map.date_publication} which posts me the date with the english format 2005.05.27.

I wish to post it in french format like that: 12 mai 2005.

By using the filter {attribute_view_gui attribute=$node.object.data_map.date_publication|datetime(' custom', ' %d %F %Y')} nothing appear.

Thank in avance for your help.

Cheers.

Stéphane

Sofie Johansson

Sunday 29 May 2005 11:13:14 pm

Hi.

Try and remove the '' around custom..This works for me :

datetime(custom,"%Y %F %d")

Developer, Novitell AB

Andrew Vorobyov

Sunday 29 May 2005 11:24:03 pm

From http://www.ez.no/ez_publish/documentation/development/libraries/ez_template/operators/miscellaneous

If you need to access the date of a "ezdate" attribute, you must use
{$node.object.data_map.datum.data_int} to get the unix timestamp ("datum" is the attribute identifier)
Of course, you don't want to print the timestamp, so do something like this:
{$node.object.data_map.datum.data_int|l10n(shortdate)}
to get a nice, localized daten print

.

Łukasz Serwatka

Sunday 29 May 2005 11:26:55 pm

To display date in your format using date datatype you can use timestamp and datetime. attribute_view_gui displays date in format 2005.05.12

{$node.object.data_map.date_publication.content.timestamp|datetime( 'custom', '%d %F %Y' )}

Output is 30 May 2005

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

Albert Hornos

Wednesday 01 June 2005 1:25:13 am

You always have the possibility to take the fields one by one.

{$node.data_map.date_publication.content.day}
{$node.data_map.date_publication.content.month}
{$node.data_map.date_publication.content.year}
{$node.data_map.date_publication.content.hour}
{$node.data_map.date_publication.content.minute}

It isn't so elegant but it works fine!!

Stéphane Bullier

Wednesday 01 June 2005 2:36:58 am

Hi,

Thank a lot for yours answers.

It's ok.

Bye

Stéphane