format number

Author Message

Mike Makris

Friday 08 October 2010 8:10:33 am

How do I format a number so that it has a leading zero if single digit - to be used as the day number in a date dropdown?

MikeM

Marko Žmak

Friday 08 October 2010 3:06:30 pm

Look at the datetime function:

http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Template-operators/Formatting-and-internationalization/datetime

What you probably need is:

{$date|datetime(custom, '%d')}

where the $datetime should be the timestamp of the date you want to display.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

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 05:13:15
Script start
Timing: Jan 18 2025 05:13:15
Module start 'layout'
Timing: Jan 18 2025 05:13:15
Module start 'content'
Timing: Jan 18 2025 05:13:16
Module end 'content'
Timing: Jan 18 2025 05:13:16
Script end

Main resources:

Total runtime1.2277 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 587.7891152.6094
Module start 'layout' 0.00520.0025 740.398439.4063
Module start 'content' 0.00771.2186 779.8047524.9453
Module end 'content' 1.22620.0014 1,304.75008.3594
Script end 1.2277  1,313.1094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.2469160.0002
Check MTime0.00130.1036160.0001
Mysql Total
Database connection0.00090.074010.0009
Mysqli_queries1.188096.7705540.0220
Looping result0.00050.0401520.0000
Template Total1.199897.720.5999
Template load0.00190.157920.0010
Template processing1.197897.566920.5989
Template load and register function0.00040.031010.0004
states
state_id_array0.00180.145610.0018
state_identifier_array0.00080.068920.0004
Override
Cache load0.00150.1259110.0001
Sytem overhead
Fetch class attribute can translate value0.00060.047020.0003
Fetch class attribute name0.00110.090530.0004
XML
Image XML parsing0.00060.052220.0003
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00080.0622180.0000
String conversion0.00000.000540.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs