Dutch Date format in Table_view.php

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
pvisser
Veteran Member
Posts: 38
Joined: 2013-10-30 12:48

Dutch Date format in Table_view.php

Post by pvisser » 2015-07-11 19:11

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.

User avatar
a.gneady
Site Admin
Posts: 1354
Joined: 2012-09-27 14:46
Contact:

Re: Dutch Date format in Table_view.php

Post by a.gneady » 2015-07-13 14:07

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
:idea: AppGini plugins to add more power to your apps:

pvisser
Veteran Member
Posts: 38
Joined: 2013-10-30 12:48

Re: Dutch Date format in Table_view.php

Post by pvisser » 2015-07-20 08:22

Thank you So mutch. It works..

Post Reply