Forums / Setup & design / Date formatting

Date formatting

Author Message

Daniele Turcato

Friday 25 July 2003 1:55:35 pm

I would want to print the date in this format: 25.07.2003 but I do not succeed to us. I have read other messages and I have tried in this way:

{attribute_view_gui attribute=$Child:item.data_map.data|datetime(custom,"%d %m %Y";)}

but it does not work and it prints always 2003.07.25 Someone can help me?
Thanks

english by google ;-)

Alex Jones

Friday 25 July 2003 2:05:52 pm

If you are familiar with PHP you can try to edit the ezdate datatype directly to make your change - or perhaps create a new datatype from a copy of ezdate (recommended). The datatype is in kernel/classes/datatypes/ezdate/

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Daniele Turcato

Friday 25 July 2003 2:22:21 pm

Thanks a lot Alex

Daniele Turcato

Friday 25 July 2003 2:35:26 pm

to modify the class is too much complicated for me, exists an other way?

Thanks

liu spider

Saturday 26 July 2003 3:38:44 am

edit your language file under share/locale/

eg. you use united kingdom english, then you should edit share/locale/eng-GB.ini

in that file, find section DateTime, and you'll understand

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

Jan Borsodi

Saturday 26 July 2003 4:05:39 am

The output of the date datatype is controlled by the template content/datatype/view/ezdate.tpl (in design/standard/templates). Copy it to your own design and change the contents.
Example code:

{section show=$attribute.content.is_valid}{$attribute.content.timestamp|datetime(custom,"%d %m %Y")}{/section}

Also to clear up some misunderstandings in your code.
The expression $Child:item.data_map.data will return an object of the type eZContentObjectAttribute and cannot be converted directly to a date string. The datetime (or l10n(date) ) operator will only work on timestamps which are simple integers (number).
And also the ; (semicolon) after your string will probably make the template parser complain.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Christian Lundvang

Tuesday 29 July 2003 2:24:43 am

Hi.

I've got, somewhat, the same problem. I am listing out some articles, and I wish to show when they where published. I have a datefield in my class which is called "publisert". I use this:
{$Child:item.data_map.publisert}, but this gives me a date in 1970!?!

Thanks in advance

--
Best Regards
Christian Lundvang
http://www.nxc.no

Christian Lundvang

Tuesday 29 July 2003 2:42:05 am

Found it!

{$Child:item.data_map.publisert.data_int|l10n(date)}

Thanks to Richard Wood.

--
Best Regards
Christian Lundvang
http://www.nxc.no