Date custom field display format

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
leshurex
Posts: 2
Joined: 24 May 2017, 07:22

Date custom field display format

Post by leshurex »

I'm having problems trying to display a custom field of type 'date' in the correct format.
The field is retrieved in epoch (as is stored in 'mantis_custom_field_string_table').

For example, if I set the field with '2017'; 'May'; '15', after submit the field displays '1494806400'.

How can I configure it to display something like 'Y-m-d'?

Thanks!
Mantis: 2.4.1
PHP: 5.6.25
SQL: MySQL 5.7.14
leshurex
Posts: 2
Joined: 24 May 2017, 07:22

Re: Date custom field display format

Post by leshurex »

Finally I've managed to overcome this problem by modifying the function 'print_custom_field_value' in 'custom_field_api.php'

Code: Select all

if ($p_def['type'] == 8) {
    echo string_display_line_links( date( config_get('short_date_format'), $t_custom_field_value) );
} else {
    echo string_display_line_links( $t_custom_field_value );		
}
I don't know if this is a bug or there's another problem with my setup that I'm not aware of.
Mantis: 2.4.1
PHP: 5.6.25
SQL: MySQL 5.7.14
atrol
Site Admin
Posts: 8374
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Date custom field display format

Post by atrol »

This is a known issue in 2.4.1, see http://www.mantisbt.org/bugs/view.php?id=22926
I recommend to use 2.4.0 until this is fixed in 2.4.2.
Please use Search before posting and read the Manual
Post Reply