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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:22:37
Script start
Timing: Jan 18 2025 19:22:37
Module start 'layout'
Timing: Jan 18 2025 19:22:37
Module start 'content'
Timing: Jan 18 2025 19:22:37
Module end 'content'
Timing: Jan 18 2025 19:22:37
Script end

Main resources:

Total runtime0.0259 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.7891152.6094
Module start 'layout' 0.00600.0036 740.398439.4297
Module start 'content' 0.00970.0134 779.828197.2891
Module end 'content' 0.02310.0027 877.117242.3047
Script end 0.0258  919.4219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003111.8030140.0002
Check MTime0.00135.1362140.0001
Mysql Total
Database connection0.00062.469510.0006
Mysqli_queries0.003212.484030.0011
Looping result0.00000.054410.0000
Template Total0.00207.810.0020
Template load0.00114.116210.0011
Template processing0.00103.686810.0010
Override
Cache load0.00082.952410.0008
General
dbfile0.00031.283680.0000
String conversion0.00000.026740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs