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 2030114 commit f4c5ad9Copy full SHA for f4c5ad9
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.
@@ -45,4 +47,21 @@
45
47
class TimeLegacy extends DateTime
46
48
{
49
use TimeTrait;
50
+
51
+ /**
52
+ * Returns a new instance with the date set to the new timestamp.
53
+ *
54
+ * @param int $timestamp
55
56
+ * @return self
57
58
+ * @throws Exception
59
+ */
60
+ #[ReturnTypeWillChange]
61
+ public function setTimestamp($timestamp)
62
+ {
63
+ $time = date('Y-m-d H:i:s', $timestamp);
64
65
+ return self::parse($time, $this->timezone, $this->locale);
66
+ }
67
}
0 commit comments