Share » Forums » Setup & design » Date Attribute formatting

Date Attribute formatting

Date Attribute formatting

Thursday 05 February 2009 4:14:41 am - 5 replies

Author Message

Damien Pobel

Sunday 08 February 2009 3:12:49 pm

Hi

As far as I know, there is no settings to control the format of a date (or any other datatype) in the URL. The only way to do that is probably to write an extension providing an URL Alias filter. dpGNU [1] is a good example of such an extension (it adds the node id at the end of the URL), you can probably adapt it to your needs.

[1] http://ez.no/developer/contribs/applications/dpgnu_dp_google_news_url

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Hadi Jadallah

Monday 09 February 2009 4:53:15 am

Thanks Damien... Ill take a look to see if I can use the same technique.

Christoph von Siebenthal

Sunday 06 December 2009 12:38:31 am

Object Name Pattern uses DateTimeFormat= ... setting in share/locale/[yourlocale]

The options are the same as for the datetime operator

Of course you have to check if the modified DateTimeFormat doesn't destroy other views where it is used.

to change the datetime operator there could be necessary.

Comment:

Do we have to wait until version 10 for something like a SystemDateTimeFormat settings to be availlable?
And the possibility to extend locale with a ini.append.php technique?

It happens I found this on the ez forums at a time where the search results where ordered by descending publishing date.

It seems to me that be a priority to take this new forum from beta to CR stage.

And there needs to be a way to contribute without having to search during one hour what has or has not allready been noticed and discussed. I'm ready and motivated to share my answers to difficulties I found, by a can't afford to loose time in endless searching.

Christoph von Siebenthal

Tuesday 12 January 2010 11:27:57 am

Ok, since 4.2 it is DateFormat for Date date attribute. Of course that's more logical.

I didn't check if it is still DateTimeFormat for an DateTime attribute.

Carlos Revillo

Tuesday 12 January 2010 2:58:53 pm

you can also control the format doing a little hack. please correct me if i'm wrong.

if your date is datetime type, you can take a look at

kernel/classes/datatypes/ezdatetime/ezdatetimetype.php

There you'll find a function called title. Here's the code

function title( $contentObjectAttribute, $name = null )
{
 $locale = eZLocale::instance();
 $retVal
= $contentObjectAttribute->attribute( "data_int" ) == 0 ? '' :
$locale->formatDateTime( $contentObjectAttribute->attribute(
"data_int" ) );
 return $retVal;
}

you can modify that function and adjust $retVal to whatever you want.

Same goes for ezdate or eztime (or all of datatypes, i think)

if you prefer not to hack that file, you can create your own datatype, starting from the provided one.

Cheers.

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu