Skip to content

DateTimeWithTimeZone

Properties

dateTime

protected \Qubus\ValueObjects\DateTime\DateTime $dateTime

timeZone

protected \Qubus\ValueObjects\DateTime\TimeZone $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".

public __toString(): string

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.

public getDateTime(): \Qubus\ValueObjects\DateTime\DateTime

getTimeZone

Returns timezone from current DateTimeWithTimeZone.

public getTimeZone(): \Qubus\ValueObjects\DateTime\TimeZone

toNativeCarbonImmutable

Returns a Carbon version of the current DateTimeWithTimeZone.

public toNativeCarbonImmutable(): \Carbon\CarbonImmutable

Throws:



Automatically generated on 2025-10-13