Forums / Developer / Date datatype formating

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

eZ debug

Timing: Jan 30 2025 06:53:04
Script start
Timing: Jan 30 2025 06:53:04
Module start 'content'
Timing: Jan 30 2025 06:53:04
Module end 'content'
Timing: Jan 30 2025 06:53:04
Script end

Main resources:

Total runtime0.2691 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0107 587.9297370.2969
Module start 'content' 0.01070.0175 958.22661,005.5000
Module end 'content' 0.02820.2409 1,963.72663,894.4141
Script end 0.2691  5,858.1406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00752.7771200.0004
Check MTime0.00230.8633200.0001
Mysql Total
Database connection0.00100.362210.0010
Mysqli_queries0.131748.91891410.0009
Looping result0.00120.43951390.0000
Template Total0.240689.410.2406
Template load0.00070.249710.0007
Template processing0.239989.140610.2399
Override
Cache load0.00050.179810.0005
Sytem overhead
Fetch class attribute can translate value0.00260.962310.0026
XML
Image XML parsing0.00020.089910.0002
General
dbfile0.01585.8570200.0008
String conversion0.00000.001930.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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