use user configured timezone for event export

This commit is contained in:
alejandro.campos@artica.es 2023-08-03 11:03:56 +02:00
parent ece276e724
commit 1fde2ed9b1
1 changed files with 11 additions and 0 deletions

View File

@ -250,6 +250,17 @@ try {
echo csv_format_delimiter(io_safe_output($custom_data));
break;
case 'timestamp':
$target_timezone = date_default_timezone_get();
$utimestamp = $row['utimestamp'];
$datetime = new DateTime("@{$utimestamp}");
$new_datetime_zone = new DateTimeZone($target_timezone);
$datetime->setTimezone($new_datetime_zone);
$formatted_date = $datetime->format('Y-m-d H:i:s');
echo csv_format_delimiter($formatted_date);
break;
default:
echo csv_format_delimiter(io_safe_output($row[$key]));
break;