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

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 21:01:39
Script start
Timing: Jan 18 2025 21:01:39
Module start 'layout'
Timing: Jan 18 2025 21:01:39
Module start 'content'
Timing: Jan 18 2025 21:01:40
Module end 'content'
Timing: Jan 18 2025 21:01:40
Script end

Main resources:

Total runtime0.7210 sec
Peak memory usage4,096.0000 KB
Database Queries72

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 588.9453152.6094
Module start 'layout' 0.00590.0021 741.554739.4141
Module start 'content' 0.00800.7116 780.9688685.8906
Module end 'content' 0.71950.0014 1,466.859416.1875
Script end 0.7210  1,483.0469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4554160.0002
Check MTime0.00140.1922160.0001
Mysql Total
Database connection0.00070.093510.0007
Mysqli_queries0.656891.0925720.0091
Looping result0.00080.1118700.0000
Template Total0.692896.120.3464
Template load0.00210.290420.0010
Template processing0.690695.791120.3453
Template load and register function0.00010.015210.0001
states
state_id_array0.00070.101610.0007
state_identifier_array0.00110.147120.0005
Override
Cache load0.00180.2559390.0000
Sytem overhead
Fetch class attribute can translate value0.00060.079250.0001
Fetch class attribute name0.00150.213290.0002
XML
Image XML parsing0.00180.249750.0004
class_abstraction
Instantiating content class attribute0.00000.0022100.0000
General
dbfile0.00160.2237300.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs