Skip to content

Commit

Permalink
Merge pull request phpbb#6726 from rxu/ticket/17405
Browse files Browse the repository at this point in the history
[ticket/17405] Fix getting UTC date/time information logic
  • Loading branch information
marc1706 committed Sep 29, 2024
2 parents d8dc120 + 990cbe0 commit 283b4f8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions phpBB/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,17 @@ function phpbb_gmgetdate($time = false)
}

// getdate() interprets timestamps in local time.
// What follows uses the fact that getdate() and
// date('Z') balance each other out.
return getdate($time - date('Z'));
// So use UTC timezone temporarily to get UTC date info array.
$current_timezone = date_default_timezone_get();

// Set UTC timezone and get respective date info
date_default_timezone_set('UTC');
$date_info = getdate($time);

// Restore timezone back
date_default_timezone_set($current_timezone);

return $date_info;
}

/**
Expand Down

0 comments on commit 283b4f8

Please sign in to comment.