Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

timezone patch #855

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
timezone patch
  • Loading branch information
Marcello Barbieri committed May 3, 2024
commit 0029b8130df3e1b6283b62dbd116e92177af9d94
9 changes: 6 additions & 3 deletions src/transformer/utils/create_timestamp.php
Original file line number Diff line number Diff line change
@@ -27,14 +27,17 @@
namespace src\transformer\utils;
defined('MOODLE_INTERNAL') || die();

date_default_timezone_set('Europe/London');

/**
* Transformer utility to create standard timestamp.
*
* @param string $time The timestamp of the event.
* @return string
*/
function create_timestamp($time) {
return date('c', $time);
// Set timezone back to site default after this manual change.
$timezone = date_default_timezone_get();
date_default_timezone_set('Europe/London');
$date = date('c', $time);
date_default_timezone_set($timezone);
return $date;
}