What could be causing the discrepancy in system time when using the gmdate function in PHP?

The discrepancy in system time when using the gmdate function in PHP could be due to the server's timezone settings not being correctly configured. To solve this issue, you can set the timezone in your PHP script using the date_default_timezone_set function before calling the gmdate function.

// Set the timezone to UTC before calling gmdate
date_default_timezone_set('UTC');

// Get the current UTC time using gmdate
$currentTime = gmdate('Y-m-d H:i:s');

echo $currentTime;