Trait Shared
Direct Known Users
Methods summary
abstract public
setDate( integer $year
, integer $month
, integer $day
)
: DateTime|DateTimeImmutable
Parameters
$year
$month
$day
Returns
abstract public
setTime( integer $hour
, integer $minute
, integer|null $second
= null )
: DateTime|DateTimeImmutable
Parameters
$hour
$minute
$second
Returns
public
__construct( string $time
= 'now', DateTimeZone|string|null $timezone
= null )
If the time zone is specified as a string a \DateTimeZone instance is created and used instead.
If the time zone is specified as a string a \DateTimeZone instance is created and used instead.
<?php use ICanBoogie\ImmutableDateTime as DateTime; new DateTime('2001-01-01 01:01:01', new \DateTimeZone('Europe/Paris'))); new DateTime('2001-01-01 01:01:01', 'Europe/Paris'); new DateTime;
Parameters
$time
- Defaults to "now".
$timezone
public
__call( $method
, $arguments
)
Handles the format_as_*
methods.
Handles the format_as_*
methods.
Throws
in attempt to call an unsupported method.
Inheritdoc
See
public
__toString( void )
: string
Returns the datetime formatted as ISO8601.
Returns the datetime formatted as ISO8601.
Returns
The instance rendered as an ISO8601 string, or an empty string if the datetime is empty.
public
jsonSerialize( void )
: string
Returns a ISO8601 representation of the instance.
Returns a ISO8601 representation of the instance.
Returns
public
setTimezone( $timezone
)
The timezone can be specified as a string.
The timezone can be specified as a string.
If the timezone is local
the timezone returned by date_default_timezone_get() is
used instead.
Inheritdoc
public
format( $format
)
If the instance represents an empty date and the format is DATE or DB, an empty date is returned, respectively "0000-00-00" and "0000-00-00 00:00:00". Note that the time information is discarded for DB. This only apply to DATE and DB formats. For instance RSS will return the following string: "Wed, 30 Nov -0001 00:00:00 +0000".
If the instance represents an empty date and the format is DATE or DB, an empty date is returned, respectively "0000-00-00" and "0000-00-00 00:00:00". Note that the time information is discarded for DB. This only apply to DATE and DB formats. For instance RSS will return the following string: "Wed, 30 Nov -0001 00:00:00 +0000".
Inheritdoc
Magic methods summary
public
format_as_atom( void )
: string
format_as_atom() Formats the instance according to ATOM.
format_as_atom() Formats the instance according to ATOM.
Returns
public
format_as_cookie( void )
: string
format_as_cookie() Formats the instance according to COOKIE.
format_as_cookie() Formats the instance according to COOKIE.
Returns
public
format_as_iso8601( void )
: string
format_as_iso8601() Formats the instance according to ISO8601.
format_as_iso8601() Formats the instance according to ISO8601.
Returns
public
format_as_rfc822( void )
: string
format_as_rfc822() Formats the instance according to RFC822.
format_as_rfc822() Formats the instance according to RFC822.
Returns
public
format_as_rfc850( void )
: string
format_as_rfc850() Formats the instance according to RFC850.
format_as_rfc850() Formats the instance according to RFC850.
Returns
public
format_as_rfc1036( void )
: string
format_as_rfc1036() Formats the instance according to RFC1036.
format_as_rfc1036() Formats the instance according to RFC1036.
Returns
public
format_as_rfc1123( void )
: string
format_as_rfc1123() Formats the instance according to RFC1123.
format_as_rfc1123() Formats the instance according to RFC1123.
Returns
public
format_as_rfc2822( void )
: string
format_as_rfc2822() Formats the instance according to RFC2822.
format_as_rfc2822() Formats the instance according to RFC2822.
Returns
public
format_as_rfc3339( void )
: string
format_as_rfc3339() Formats the instance according to RFC3339.
format_as_rfc3339() Formats the instance according to RFC3339.
Returns
public
format_as_rss( void )
: string
format_as_rss() Formats the instance according to RSS.
format_as_rss() Formats the instance according to RSS.
Returns
public
format_as_w3c( void )
: string
format_as_w3c() Formats the instance according to W3C.
format_as_w3c() Formats the instance according to W3C.
Returns
public
format_as_db( void )
: string
format_as_db() Formats the instance according to DB.
format_as_db() Formats the instance according to DB.
Returns
public
format_as_number( void )
: string
format_as_number() Formats the instance according to NUMBER.
format_as_number() Formats the instance according to NUMBER.