Date datatype formating

Author Message

mario feichtinger

Wednesday 21 May 2003 2:20:32 am

>Re: Date datatype formating
>as i unserstand from ur 1st post, that date format what ur have is >2002.12.20, then u will need to convert it to timestamp to use this option >in the template language !

you mean i have to change the datatype of the date attribute in the database? my date attribute has the datatype date field.
what is correctly the right datatype? is this time field or date time field?

>try this
>{$content_version.data_map.published|datetime(custom,"%l %d %F %Y")}
>if u got as u want, then ok, if not then u need to translate the date in the >local files/ files maybe !

which files do you mean?

Selmah Maxim

Wednesday 21 May 2003 5:18:50 am

Hi ... (agian) :)

listen, you have add to your class date datatype, to make the user insert the date ,am i right ?

if yes, then you cann`t format the date, coz is insert it to the databese with another format (2002.12.20), for formating the date as you need, the date must be timestamp, it`s look like this (15689186), it`s the number of secends, if u count lets say 6 month is 7776000 secend as i think, so in ur case u need to reformat it and then send it back to datatime operator, u will need to write some php code for that, the function for converting ur date is easy:

Function DateToTimonthtamp($date)
{
$date=str_replace('.','',$date);

$year = substr( $date, 0, 4 ) ;
$month = substr( $date, 4, 2 ) ;
$day = substr( $date, 6, 2 ) ;
$hours = substr( $date, 8, 2 ) ;

$unixTime = strtotime( "$year-$month-$day" ) ;
return $unixTime ;
}
echo DateToTimonthtamp("2002.12.20");

but how to use it in ez32 code is hard !

what ever, ur date look nice, keep it at is it :)

mario feichtinger

Thursday 22 May 2003 12:48:28 am

hi,
i have changed my datatype from date to datetime and to time.
in the template i tried these
{attribute_view_gui attribute=$content_version.data_map.dt|datetime(custom,"%d %m %Y")}{attribute_view_gui attribute=$content_version.data_map.t|datetime(custom,"%d %m %Y")}.
but with no success.
for what is the ez3 function datetime?
grrrhh

Bruce Morrison

Friday 23 May 2003 6:53:44 pm

Hi Mario

Try
{$content_version.data_map.published.data_int|datetime(custom,"%d %m %Y")}

{attribute_view_gui attribute=$content_version.data_map.published|datetime(custom,"%d %m %Y")}

doesn't work as the attribute_view_gui returns the formated datetime and the datetime function expects an interger as a parameter.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

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 11:42:34
Script start
Timing: Jan 18 2025 11:42:34
Module start 'layout'
Timing: Jan 18 2025 11:42:34
Module start 'content'
Timing: Jan 18 2025 11:42:35
Module end 'content'
Timing: Jan 18 2025 11:42:35
Script end

Main resources:

Total runtime1.3880 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 587.9141152.6250
Module start 'layout' 0.00550.0040 740.539139.4453
Module start 'content' 0.00951.3768 779.9844586.0703
Module end 'content' 1.38630.0016 1,366.054712.1719
Script end 1.3879  1,378.2266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2336160.0002
Check MTime0.00130.0933160.0001
Mysql Total
Database connection0.00080.057310.0008
Mysqli_queries1.317294.8982620.0212
Looping result0.00070.0521600.0000
Template Total1.344796.920.6724
Template load0.00190.134420.0009
Template processing1.342896.747620.6714
Template load and register function0.00020.011310.0002
states
state_id_array0.00310.224810.0031
state_identifier_array0.00190.138320.0010
Override
Cache load0.00160.1186470.0000
Sytem overhead
Fetch class attribute can translate value0.00060.040830.0002
Fetch class attribute name0.00120.088650.0002
XML
Image XML parsing0.00080.060930.0003
class_abstraction
Instantiating content class attribute0.00000.000950.0000
General
dbfile0.00090.0616160.0001
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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs