ezdatetime as object name pattern

Author Message

Mads Ovesen

Monday 16 January 2006 2:18:40 pm

Between ez v. 3.4.4 and 3.4.7 there has been a change in the way ezpublish interprets the ezdatetime datatype when used as an object name pattern. In v. 3.4.4 is it shown as a timestamp and in v. 3.4.7 it is shown in the datetime format. Right now I have updated a site from 3.4.4 to 3.4.7, so some objects of a class (those prior to the upgrade), which uses ezdatetime as object name pattern, show a timestamp while others (those after the upgrade) show it in datetimeformat. This is confusing, because I want to sort the objects by 'name', that is by the timestamp. The new objects, when sorted by name, is sorted like fx:
friday_13_05_...
monday_07_03_...
saturday_05_09_...
thursday_03_01_...
i.e. not in any cronological order. How/Where can I change it back, so when the ezdatetime is used as a object name pattern, it uses the timestamp and not a datetime format of it??

- Thanks Mads

/m

Mads Ovesen

Thursday 19 January 2006 11:57:25 pm

Anyone?? Ez crew, why has this been changed??

/m

Ɓukasz Serwatka

Friday 20 January 2006 1:25:41 am

Hi Mads,

Take a look at eZDateTimeType::title() method in the kernel/classes/datatypes/ezdatetime/ezdatetimetype.php file. I can suppose that reason behind of this change was that timestamp is not human readable as object name. Object name like 'Saturday 14 January 2006 10:32:00 pm' says more about the date. However you can always do sorting on datetime attribute using sort_by or play with output format using datetime operator.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Tobias Adam

Thursday 01 June 2006 6:45:53 am

Hi Mads,

I had the same problem and tried format the resulting object's name when using a ezdatetime datatype as object name pattern. I wanted something like YYYY-MM-DD, so that I could use the standard "sort by name"-function in the admin view to sort the items chronologically in the backend.

Because of Lukasz' tip I found out that eZ (I'm currently using version 3.6.1) uses the DateTimeFormat entry in the currently used locale ini-file (located in /share/locale) to create an object name based on an ezdatetime datatype.

In my case, I edited the file ger-DE.ini in /share/locale, where I changed the value DateTimeFormat=%l, %d.%F %Y %H:%i:%s in the DateTime settings group to DateTimeFormat=%Y-%m-%d %H:%i, which leads to a result like YYYY-MM-DD HH:MM.

[DateTime]
TimeFormat=%H:%i:%s
ShortTimeFormat=%H:%i
DateFormat=%l, %d.%F %Y
ShortDateFormat=%d.%m.%Y
#DateTimeFormat=%l, %d.%F %Y %H:%i:%s
DateTimeFormat=%Y-%m-%d %H:%i
ShortDateTimeFormat=%d.%m.%Y %H:%i
MondayFirst=yes

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.