Skip to content

DateTime

Properties

date

protected \Qubus\ValueObjects\DateTime\Date $date

time

protected \Qubus\ValueObjects\DateTime\Time $time

Methods

__construct

Returns a new DateTime object.

public __construct(\Qubus\ValueObjects\DateTime\Date $date, ?\Qubus\ValueObjects\DateTime\Time $time = null): mixed

Parameters:

Parameter Type Description
$date \Qubus\ValueObjects\DateTime\Date
$time ?\Qubus\ValueObjects\DateTime\Time

Throws:


__toString

Returns DateTime as string in format "Y-n-j G:i:s".

public __toString(): string

fromNative

Returns a new DateTime object from native values.

public static fromNative(): \Qubus\ValueObjects\DateTime\DateTime|\Qubus\ValueObjects\ValueObject
  • This method is static.

Throws:


fromNativeCarbonImmutable

Returns a new DateTime from native CarbonImmutable.

public static fromNativeCarbonImmutable(\Carbon\CarbonImmutable $dateTime): \Qubus\ValueObjects\DateTime\DateTime
  • This method is static.

Parameters:

Parameter Type Description
$dateTime \Carbon\CarbonImmutable

Throws:


now

Returns current DateTime.

public static now(): \Qubus\ValueObjects\DateTime\DateTime
  • This method is static.

Throws:


equals

Tells whether two DateTime are equal by comparing their values.

public equals(\Qubus\ValueObjects\ValueObject $dateTime): bool

Parameters:

Parameter Type Description
$dateTime \Qubus\ValueObjects\ValueObject

getDate

Returns date from current DateTime.

public getDate(): \Qubus\ValueObjects\DateTime\Date

getTime

Returns time from current DateTime.

public getTime(): \Qubus\ValueObjects\DateTime\Time

toNativeCarbonImmutable

Returns a CarbonImmutable version of the current DateTime.

public toNativeCarbonImmutable(): \Carbon\CarbonImmutable


Automatically generated on 2025-10-13