We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f3a9ebb commit 6185dbeCopy full SHA for 6185dbe
system/I18n/TimeLegacy.php
@@ -14,6 +14,8 @@
14
namespace CodeIgniter\I18n;
15
16
use DateTime;
17
+use Exception;
18
+use ReturnTypeWillChange;
19
20
/**
21
* Legacy Time class.
@@ -47,4 +49,21 @@
47
49
class TimeLegacy extends DateTime
48
50
{
51
use TimeTrait;
52
+
53
+ /**
54
+ * Returns a new instance with the date set to the new timestamp.
55
+ *
56
+ * @param int $timestamp
57
58
+ * @return self
59
60
+ * @throws Exception
61
+ */
62
+ #[ReturnTypeWillChange]
63
+ public function setTimestamp($timestamp)
64
+ {
65
+ $time = date('Y-m-d H:i:s', $timestamp);
66
67
+ return self::parse($time, $this->timezone, $this->locale);
68
+ }
69
}
0 commit comments