Last active
February 22, 2018 18:55
-
-
Save Pebblo/db38b33d16d8651c11bb1ef09bff7942 to your computer and use it in GitHub Desktop.
Example of how to use the date formats set within your sites general settings in the CSV report columns.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Please do not add the PHP tag if you already have one. | |
function tw_reg_date_format( $reg_csv_array, $reg_row ) { | |
//Set the columns you can't to convert the date on here. | |
$date_columns = array( | |
'Ticketdatum', | |
'Time registration occurred[REG_date]' | |
); | |
//Loop through the columns set and use localized date formats. | |
foreach($date_columns as $column) { | |
//Hardcode the date format? | |
//$date_format = 'D., d.m.y'; | |
//Use the formats set in general settings. | |
$date_format = get_option( 'date_format' ); | |
$time_format = get_option( 'time_format' ); | |
$reg_csv_array[$column] = date_i18n( $date_format . ' ' . $time_format, strtotime( $reg_csv_array[$column] ) ); | |
} | |
return $reg_csv_array; | |
} | |
add_filter('FHEE__EE_Export__report_registrations__reg_csv_array', 'tw_reg_date_format', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ref:
https://eventespresso.com/topic/date-format-of-csv-export-german/