| 
		
			| Convert date ccyy-mm-dd to dd.mm.ccyy [message #5613] | Wed, 08 June 2016 05:18  |  
			| 
				
				
					|  htManager Messages: 456
 Registered: May 2014
 | Senior Member |  |  |  
	| If I print a pdf report I make changes in $fieldarray as mentioned in post sreen/report - concat fields in function _cm_post_fetchRow ($fieldarray). The date in $fieldarray['training_datum'] is shown in format ccyy-mm-dd. With the following code I want to change this but: 
 $css_array[0] = 'ddmmccyy';
 $fieldarray['training_datum'] = $this->formatData($fieldarray['training_datum'], $css_array);
 
 Is this the right way?
 
 
 |  
	|  |  | 
	|  | 
	|  | 
	| 
		
			| Re: Convert date ccyy-mm-dd to dd.mm.ccyy [message #5620 is a reply to message #5618] | Thu, 09 June 2016 05:05   |  
			| 
				
				
					|  AJM Messages: 2386
 Registered: April 2006
 Location: Surrey, UK
 | Senior Member |  |  |  
	| If you look at the formatData() method inside std.table.class.inc you will see that it can only format date fields if those fields have entries in the $fieldspec array which identifies them as having a type of 'date' or 'datetime'. If your output contains a field which does not have an entry in the $fieldspec array then it cannot be formatted and will be output as-is. You can fix this by manually updating the $fieldspec array in the _cm_changeConfig() method. 
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org
 |  
	|  |  | 
	|  | 
	|  | 
	|  | 
	| 
		
			| Re: Convert date ccyy-mm-dd to dd.mm.ccyy [message #5624 is a reply to message #5623] | Sat, 11 June 2016 05:22   |  
			| 
				
				
					|  AJM Messages: 2386
 Registered: April 2006
 Location: Surrey, UK
 | Senior Member |  |  |  
	| In my prototype XAMPLE application, which is available in the online demo, I go to PROTO->Example->Person, select an entry and press the 'Output to PDF (D)' button and this runs through the code which you say is at fault. Line 279 contains the call to $dbobject->formatData(fieldarray). Before the call the value of START_DATE is in the format 'ccyy-mm-dd' and afterwards it is 'dd Mmm ccyy'. It appears in the PDF output as 'dd Mmm ccyy' so I can see nothing wrong. 
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org
 |  
	|  |  | 
	|  | 
	| 
		
			| Re: Convert date ccyy-mm-dd to dd.mm.ccyy [message #5627 is a reply to message #5626] | Tue, 14 June 2016 04:23   |  
			| 
				
				
					|  AJM Messages: 2386
 Registered: April 2006
 Location: Surrey, UK
 | Senior Member |  |  |  
	| If you have created a new field in $fieldarray which does not have an entry in $this->fieldspec then the framework does not know what type it is, therefore cannot format it. You can correct this by adding an entry to $this->fieldspec in the _cm_changeConfig() method. 
 However, if the field is a concatenation of a string and a date then it cannot be formatted by the framework as it is a mixture of types. In this case you will have to format the date yourself before you append it to the string using the getExternalDate function.
 
 Tony Marston
 http://www.tonymarston.net
 http://www.radicore.org
 |  
	|  |  | 
	|  |