DateTimeWithTimeZone
- Full name:
\Qubus\ValueObjects\DateTime\DateTimeWithTimeZone
- This class implements:
\Qubus\ValueObjects\ValueObject
Properties
dateTime
timeZone
Methods
__construct
Returns a new DateTimeWithTimeZone object.
public __construct(\Qubus\ValueObjects\DateTime\DateTime $datetime, ?\Qubus\ValueObjects\DateTime\TimeZone $timezone = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$datetime | \Qubus\ValueObjects\DateTime\DateTime | |
$timezone | ?\Qubus\ValueObjects\DateTime\TimeZone |
__toString
Returns DateTime as string in format "Y-n-j G:i:s.u e".
fromNative
Returns a new DateTime object from native values.
public static fromNative(): \Qubus\ValueObjects\DateTime\DateTimeWithTimeZone|\Qubus\ValueObjects\ValueObject
- This method is static.
Throws:
fromNativeCarbonImmutable
Returns a new DateTime from a native PHP \DateTime.
public static fromNativeCarbonImmutable(\Carbon\CarbonImmutable $nativeDatetime): \Qubus\ValueObjects\DateTime\DateTimeWithTimeZone|\Qubus\ValueObjects\ValueObject
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$nativeDatetime | \Carbon\CarbonImmutable |
Throws:
now
Returns a DateTimeWithTimeZone object using current DateTime and default TimeZone.
public static now(): \Qubus\ValueObjects\DateTime\DateTimeWithTimeZone|\Qubus\ValueObjects\ValueObject
- This method is static.
Throws:
equals
Tells whether two DateTimeWithTimeZone are equal by comparing their values.
public equals(\Qubus\ValueObjects\DateTime\DateTimeWithTimeZone|\Qubus\ValueObjects\ValueObject $dateTimeWithTimeZone): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$dateTimeWithTimeZone | \Qubus\ValueObjects\DateTime\DateTimeWithTimeZone|\Qubus\ValueObjects\ValueObject |
sameTimestampAs
Tells whether two DateTimeWithTimeZone represents the same timestamp.
public sameTimestampAs(\Qubus\ValueObjects\DateTime\DateTimeWithTimeZone|\Qubus\ValueObjects\ValueObject $dateTimeWithTimeZone): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$dateTimeWithTimeZone | \Qubus\ValueObjects\DateTime\DateTimeWithTimeZone|\Qubus\ValueObjects\ValueObject |
Throws:
getDateTime
Returns datetime from current DateTimeWithTimeZone.
getTimeZone
Returns timezone from current DateTimeWithTimeZone.
toNativeCarbonImmutable
Returns a Carbon version of the current DateTimeWithTimeZone.
Throws:
Automatically generated on 2025-10-13