Final Class Yiisoft\Db\Expression\Value\DateTimeValue
| Inheritance | Yiisoft\Db\Expression\Value\DateTimeValue |
|---|---|
| Implements | Yiisoft\Db\Expression\ExpressionInterface |
Represents a value that should be treated as a date and time value for specific column type.
Psalm Types
| Name | Value |
|---|---|
| SupportedColumnType | \Yiisoft\Db\Constant\ColumnType::DATE|\Yiisoft\Db\Constant\ColumnType::DATETIME|\Yiisoft\Db\Constant\ColumnType::DATETIMETZ|\Yiisoft\Db\Constant\ColumnType::TIME|\Yiisoft\Db\Constant\ColumnType::TIMETZ|\Yiisoft\Db\Constant\ColumnType::TIMESTAMP|\Yiisoft\Db\Constant\ColumnType::BIGINT|\Yiisoft\Db\Constant\ColumnType::INTEGER|\Yiisoft\Db\Constant\ColumnType::FLOAT|\Yiisoft\Db\Constant\ColumnType::DOUBLE|\Yiisoft\Db\Constant\ColumnType::DECIMAL |
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $info | array | Yiisoft\Db\Expression\Value\DateTimeValue | |
| $type | string | Yiisoft\Db\Expression\Value\DateTimeValue | |
| $value | integer|float|string|\Stringable|DateTimeInterface | Yiisoft\Db\Expression\Value\DateTimeValue |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Db\Expression\Value\DateTimeValue |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| SUPPORTED_TYPES | [ \Yiisoft\Db\Constant\ColumnType::DATE => true, \Yiisoft\Db\Constant\ColumnType::DATETIME => true, \Yiisoft\Db\Constant\ColumnType::DATETIMETZ => true, \Yiisoft\Db\Constant\ColumnType::TIME => true, \Yiisoft\Db\Constant\ColumnType::TIMETZ => true, \Yiisoft\Db\Constant\ColumnType::TIMESTAMP => true, \Yiisoft\Db\Constant\ColumnType::BIGINT => true, \Yiisoft\Db\Constant\ColumnType::INTEGER => true, \Yiisoft\Db\Constant\ColumnType::FLOAT => true, \Yiisoft\Db\Constant\ColumnType::DOUBLE => true, \Yiisoft\Db\Constant\ColumnType::DECIMAL => true, ] | Yiisoft\Db\Expression\Value\DateTimeValue |
Property Details
Method Details
| public mixed __construct ( DateTimeInterface|float|integer|string|\Stringable $value, string $type = ColumnType::DATETIMETZ, array $info = [] ) | ||
| $value | DateTimeInterface|float|integer|string|\Stringable |
The value to be treated as a date and time value. |
| $type | string |
The column type. The following types are supported:
|
| $info | array |
Additional information about {@see \Yiisoft\Db\Schema\Column\ColumnInterface the column}. |
public function __construct(
public readonly int|float|string|Stringable|DateTimeInterface $value,
public readonly string $type = ColumnType::DATETIMETZ,
public readonly array $info = [],
) {
if (!isset(self::SUPPORTED_TYPES[$type])) {
throw new InvalidArgumentException("The type '$type' is not supported by DateTimeValue.");
}
}
Signup or Login in order to comment.