forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeLegacy.php
More file actions
65 lines (58 loc) · 1.69 KB
/
TimeLegacy.php
File metadata and controls
65 lines (58 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <[email protected]>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\I18n;
use DateTime;
use Exception;
/**
* Legacy Time class.
*
* This class is only for backward compatibility. Do not use.
* This is not immutable! Some methods are immutable,
* but some methods can alter the state.
*
* @property int $age read-only
* @property string $day read-only
* @property string $dayOfWeek read-only
* @property string $dayOfYear read-only
* @property bool $dst read-only
* @property string $hour read-only
* @property bool $local read-only
* @property string $minute read-only
* @property string $month read-only
* @property string $quarter read-only
* @property string $second read-only
* @property int $timestamp read-only
* @property bool $utc read-only
* @property string $weekOfMonth read-only
* @property string $weekOfYear read-only
* @property string $year read-only
*
* @phpstan-consistent-constructor
*
* @deprecated 4.3.0 Use Time instead.
* @see \CodeIgniter\I18n\TimeLegacyTest
*/
class TimeLegacy extends DateTime
{
use TimeTrait;
/**
* Returns a new instance with the date set to the new timestamp.
*
* @param int $timestamp
*
* @throws Exception
*/
public function setTimestamp($timestamp): static
{
$time = date('Y-m-d H:i:s', $timestamp);
return static::parse($time, $this->timezone, $this->locale);
}
}