Skip to content

Commit

Permalink
Format Oxidized update time (librenms#16455)
Browse files Browse the repository at this point in the history
* Format Oxidized update time 
Format Oxidized update time to local timezone (instead of UTC)

* extra space removal
* and one more
---------

Co-authored-by: PipoCanaja <[email protected]>
  • Loading branch information
dasdromedar and PipoCanaja authored Sep 29, 2024
1 parent d959bf1 commit 8d2bf6c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion includes/html/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -959,12 +959,21 @@ function get_oxidized_nodes_list()
continue;
}

// Convert UTC time string to local timezone set
$utc_time = $object['time'];
$utc_date = new DateTime($utc_time, new DateTimeZone('UTC'));
$local_timezone = new DateTimeZone(date_default_timezone_get());
$local_date = $utc_date->setTimezone($local_timezone);

// Generate local time string
$formatted_local_time = $local_date->format('Y-m-d H:i:s T');

echo '<tr>
<td>' . $device['device_id'] . '</td>
<td>' . $object['name'] . '</td>
<td>' . $device['sysName'] . '</td>
<td>' . $object['status'] . '</td>
<td>' . $object['time'] . '</td>
<td>' . $formatted_local_time . '</td>
<td>' . $object['model'] . '</td>
<td>' . $object['group'] . '</td>
<td></td>
Expand Down

0 comments on commit 8d2bf6c

Please sign in to comment.