Hi guys

I have a form that needs to be exported once a month into a CSV file. It has data with 4 date fields in it.

My question.....

Is there a way to format the date of the fields in the export from the standard DD-MMM-YYYY to DD/MM/YYYY? I have looked and looked and can find no way to do this in the settings, so i am assuming that there is some changes required in the actual code to achieve this.

At present I have to go through the export file line by line replacing all the dates with the required date format and it is extremely time consuming.

Any help would be appreciated, even if you could point me to the file that contains the date formatting on export?

Cheers all

Jason

@yuniar

Can you help at all? This is causing many problems for me. It is making me consider moving to another platform, but i really like the look and feel of this machform and want to make this work, but without this, i really can not anymore.

    abldr

    Although I don’t recommend modifying the code as it will need to be modified each time you install an upgrade, here is the code change to implement your request for version 20 of Machform.

    In file export_entries.php on line 1046

    Change from:

    }elseif($column_type_lookup[$column_name] == 'date'){ //date with format MM/DD/YYYY
    if(!empty($row[$column_name]) && ($row[$column_name] != '0000-00-00')){
    $form_data[$i][$j] = date('M d, Y',strtotime($row[$column_name]));
    }

    Change to:

    }elseif($column_type_lookup[$column_name] == 'date'){ //date with format MM/DD/YYYY
    if(!empty($row[$column_name]) && ($row[$column_name] != '0000-00-00')){
    $form_data[$i][$j] = date('d/m/Y',strtotime($row[$column_name]));
    }

    Before the change the date was exported as “Apr 03, 2024”. After the change the date was exported as “03/04/2024”.

    This works for columns of type date only.

    steve_schuckman Thank you Steve. That worked a treat, although it was the next argument from the one you posted as that was for American date format and I have European date format, but once i changed the right argument the export works exactly how i need it. You saved my beans fella and I really appreciate it.

    I know i will have to change this code each time i upgrade, but that takes 2 minutes, whereas to change the dates on the excel export takes half a day!!! It would be good for a function where you can select the date format prior to export, or as a main core date option. Whatever date format you choose, that's how it will be exported, if you know what i mean?

    Write a Reply...