Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active February 22, 2018 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/db38b33d16d8651c11bb1ef09bff7942 to your computer and use it in GitHub Desktop.
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.
<?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 );
@Pebblo
Copy link
Author

Pebblo commented Feb 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment