From 7602cb4a6a452436a621a1d46e0516d1f060a662 Mon Sep 17 00:00:00 2001 From: Toto Prayogo Date: Mon, 17 Jan 2022 23:34:57 +0700 Subject: [PATCH] Update Time.php previously not updating date even though time zone has been set --- system/I18n/Time.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/I18n/Time.php b/system/I18n/Time.php index 9d2bc96c9b40..777554291e24 100644 --- a/system/I18n/Time.php +++ b/system/I18n/Time.php @@ -256,7 +256,10 @@ public static function createFromFormat($format, $datetime, $timezone = null) */ public static function createFromTimestamp(int $timestamp, $timezone = null, ?string $locale = null) { - return new self(gmdate('Y-m-d H:i:s', $timestamp), $timezone ?? 'UTC', $locale); + $timezone ??= 'UTC'; + $date = new DateTime('now', new DateTimeZone($timezone)); + + return new self($date->setTimestamp($timestamp)->format('Y-m-d H:i:s'), $timezone, $locale); } /**