Page 1 of 1

Data Format

Posted: 2015-03-07 12:41
by danoshea
With the data format, I uploaded a large CSV file that has in a cell the date 12/31/2014. So of course in MySQL, it displays as 2014/12/31.

I want the date to display 12/31/14.

So in the dataFormats file, I added:

Code: Select all

US Short Date (example: 03/28/08); DATE_FORMAT(%%FIELD%%, '%m/%d/%y')
But I still get a display of 03/28/2008.

I did a quick change to test in the main section (when I highlight the database number in upper left) under "Localization Settings" and changed it to "Day, month, year" (instead of "Month, day, year) in the dropdown and saw the dates now displayed as 31/12/2014 once I generated the PHP pages.

So it seems that the "Localization Settings" overrides the dataFormats file so I can't display the date as 12/31/14?

Thanks

Re: Data Format

Posted: 2015-04-21 05:38
by Satya Kavala
Hi danoshea,
try this below line of code in your php file in hooks folder before/after insert and before/after update functions.
$data['date'] = date('d-m-Y', strtotime($data['date']);

it may helps you