Download the PHP package rxante/dateimmutable without Composer
On this page you can find all versions of the php package rxante/dateimmutable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package dateimmutable
PHPDateImmutable
This is an implementation of a DateImmutable class that deals only with dates and not with time. PHP has, of course, built-in, DateTime and DateTimeImmutable classes. We have found that we frequently want a class that deals only with the date.
This DateImmutable class implements all the same methods that PHP's DateTimeImmutable does, and in the same way, except where the method wouldn't make sense for a class that does not deal with time.
Methods
The Constructor
DateImmutable's constructor works exactly the same way as DateTimeImmutable's does, except that it does not accept a DateTimeZone as a second argument because timezones do not matter when you're not dealing with time.
diff (instance method)
Returns the difference between its own instance, and another instance of either DateImmutable or the DateTimeInterface
format (instance method)
Takes all the same options that PHP's DateTimeInterface does: https://www.php.net/manual/en/datetime.format.php
If any time formatting tokens are used, 0s will always be returned since there is no time on the DateImmutable class.
getTimestamp (instance method)
Gets the unix timestamp of UTC midnight for the given date.
add (instance method)
Adds an amount of days, months, and years to the existing instance's value, and returns a new instance with the new values.
Any hours, minutes, or seconds on the DateInterval argument input will be ignored.
createFromFormat (static method)
Returns new DateImmutable object formatted according to the specified format.
Takes all the same options that PHP's DateTimeImmutable does: https://www.php.net/manual/en/datetime.format.php
modify (instance method)
Creates a new instance of DateImmutable modified by the input.
Takes all the same options that PHP's DateTime classes do: https://www.php.net/manual/en/datetime.formats.php
setDate (instance method)
Sets the date to the input year/month/day and returns a new instance of the class with that value.
setISODate (instance method)
Sets the date to the input year/week/dayOfWeek and returns a new instance of the class with that value.
sub (instance method)
Subtracts an amount of days, months, and years from the existing instance's value, and returns a new instance with the new values.
Any hours, minutes, or seconds on the DateInterval argument input will be ignored.