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

eZ debug

Timing: Jan 18 2025 21:11:03
Script start
Timing: Jan 18 2025 21:11:03
Module start 'content'
Timing: Jan 18 2025 21:11:04
Module end 'content'
Timing: Jan 18 2025 21:11:04
Script end

Main resources:

Total runtime1.0107 sec
Peak memory usage4,096.0000 KB
Database Queries209

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 587.6094180.8438
Module start 'content' 0.00700.8715 768.4531690.9531
Module end 'content' 0.87850.1321 1,459.4063337.0703
Script end 1.0106  1,796.4766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.4311210.0002
Check MTime0.00150.1517210.0001
Mysql Total
Database connection0.00080.074510.0008
Mysqli_queries0.923591.36882090.0044
Looping result0.00240.23532070.0000
Template Total0.978896.820.4894
Template load0.00340.332420.0017
Template processing0.975596.512220.4877
Template load and register function0.00010.011010.0001
states
state_id_array0.00060.056910.0006
state_identifier_array0.00240.237220.0012
Override
Cache load0.00300.2966390.0001
Sytem overhead
Fetch class attribute can translate value0.00130.133260.0002
Fetch class attribute name0.00570.567790.0006
XML
Image XML parsing0.00270.269560.0005
class_abstraction
Instantiating content class attribute0.00000.0018100.0000
General
dbfile0.00260.2592410.0001
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs