PHP Class Cake\Chronos\MutableDate

This class is useful when you want to represent a calendar date and ignore times. This means that timezone changes take no effect as a calendar date exists in all timezones in each respective date.
Inheritance: extends DateTim\DateTime, implements Cake\Chronos\ChronosInterface, use trait Cake\Chronos\Traits\ComparisonTrait, use trait Cake\Chronos\Traits\DifferenceTrait, use trait Cake\Chronos\Traits\FactoryTrait, use trait Cake\Chronos\Traits\FormattingTrait, use trait Cake\Chronos\Traits\FrozenTimeTrait, use trait Cake\Chronos\Traits\MagicPropertyTrait, use trait Cake\Chronos\Traits\ModifierTrait, use trait Cake\Chronos\Traits\TestingAidTrait
ファイルを表示 Open project: cakephp/chronos Class Usage Examples

Protected Properties

Property Type Description
$toStringFormat string Format to use for __toString method when type juggling occurs.

Public Methods

Method Description
__construct ( string | null $time = 'now', DateTimeZon\DateTimeZone | string | null $tz = null ) Create a new mutable Date instance.
toImmutable ( ) : Date Create a new immutable instance from current mutable instance.

Method Details

__construct() public method

Please see the testing aids section (specifically static::setTestNow()) for more on the possibility of this constructor returning a test instance. Date instances lack time components, however due to limitations in PHP's internal Datetime object the time will always be set to 00:00:00, and the timezone will always be UTC. Normalizing the timezone allows for subtraction/addition to have deterministic results.
public __construct ( string | null $time = 'now', DateTimeZon\DateTimeZone | string | null $tz = null )
$time string | null Fixed or relative time
$tz DateTimeZon\DateTimeZone | string | null The timezone for the instance

toImmutable() public method

Create a new immutable instance from current mutable instance.
public toImmutable ( ) : Date
return Date

Property Details

$toStringFormat protected_oe static_oe property

Format to use for __toString method when type juggling occurs.
protected static string $toStringFormat
return string