Hi @pipoulito
This is expected behavior because “20190418” is how ACF stores the date in the database. You can change the format using a custom PHP function on the field: http://www.wpallimport.com/tour/export-developer-friendly/. Example function:
function my_change_date_format( $date ) {
if ( $obj = DateTime::createFromFormat( 'Ymd', $date ) ) {
return $obj->format( 'd/m/Y' );
} else {
return null;
}
}
See: https://d.pr/i/pSL9aK
thanks a lot !
But as my datefield is in a repeater field , will it work ?
-
This reply was modified 7 years, 2 months ago by
pipoulito.
Hi @pipoulito
But as my datefield is in a repeater field , will it work ?
In that case you’d need to write some custom code that uses the ‘wp_all_export_csv_rows’ hook: https://github.com/soflyy/wp-all-import-action-reference/blob/master/all-export/wp_all_export_csv_rows.php. Example snippet:
function wp_all_export_csv_rows( $articles, $options, $export_id ) {
foreach ($articles as $key => $article) {
if ( ! empty( $article["A Repeating Group_date"] ) ) {
$dates = explode( ",", $article["A Repeating Group_date"] );
foreach ( $dates as $ikey => $ivalue ) {
$dates[ $ikey ] = my_change_date_format( $ivalue );
}
$articles[ $key ]["A Repeating Group_date"] = implode( ",", $dates );
}
}
return $articles; // Return the array of records to export
}
add_filter( 'wp_all_export_csv_rows', 'wp_all_export_csv_rows', 10, 3 );
function my_change_date_format( $date ) {
if ( $obj = DateTime::createFromFormat( 'Ymd', $date ) ) {
return $obj->format( 'd/m/Y' );
} else {
return null;
}
}
thanks
muy date are names : program_0_date, program_1_date …
So how should i replace “A Repeating Group_date” please ?
thanks
-
This reply was modified 7 years, 2 months ago by
pipoulito.
Hey @pipoulito
When possible we’re happy to provide examples to point you in the right direction, but unfortunately we can’t write/adjust/troubleshoot custom code for your project as part of our support.