Page 1 of 1

Dutch Date format in Table_view.php

Posted: 2015-07-11 19:11
by pvisser
Hi there. I have a question. Is i insert a record with dat is looks like 08/07/2015. in the table view. Now, I want to format it to the dutch dat like : Maandag 8 Augustus 2015 If i look in the table_view.php i see this.

Code: Select all


// Fields that can be displayed in the table view
	$x->QueryFieldsTV=array(   
		"`Planning`.`ID`" => "ID",
		"`Planning`.`Pl_Install`" => "Pl_Install",
		"if(`Planning`.`Pl_Datum`,date_format(`Planning`.`Pl_Datum`,'%d/%m/%Y'),'')" => "Pl_Datum",
		"`Planning`.`Pl_Naam`" => "Pl_Naam",
		"`Planning`.`Pl_Straat`" => "Pl_Straat",
		"`Planning`.`Pl_Postcode`" => "Pl_Postcode",
		"`Planning`.`Pl_Plaats`" => "Pl_Plaats",
		"`Planning`.`Pl_Telefoon`" => "Pl_Telefoon",
		"`Planning`.`Pl_Tijd`" => "Pl_Tijd",
		"`Planning`.`Pl_Extra_info`" => "Pl_Extra_info",
		"IF(    CHAR_LENGTH(`Medewerkers1`.`Me_Naam`), CONCAT_WS('',   `Medewerkers1`.`Me_Naam`), '') /* Klant bezocht door */" => "Pl_DTM_Contact"
	);
Please Advice.? Greetings. Patrick.

Re: Dutch Date format in Table_view.php

Posted: 2015-07-13 14:07
by a.gneady
First, you need to set the locale of MySQL dates to Dutch. In the generated hooks/__global.php, add this line after the <?php opening tag:

Code: Select all

sql("SET lc_time_names = 'nl_NL'", $eo);
Use 'nl_BE' for Belgian Dutch or 'nl_NL' for Netherlands Dutch.

Next, in the table_view.php file, modify the date_format line to:

Code: Select all

"if(`Planning`.`Pl_Datum`,date_format(`Planning`.`Pl_Datum`,'%W %e %M %Y'),'')" => "Pl_Datum",
References:
https://dev.mysql.com/doc/refman/5.0/en ... pport.html
https://dev.mysql.com/doc/refman/5.0/en ... ate-format

Re: Dutch Date format in Table_view.php

Posted: 2015-07-20 08:22
by pvisser
Thank you So mutch. It works..