Download the PHP package icanboogie/datetime without Composer

On this page you can find all versions of the php package icanboogie/datetime. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package datetime

DateTime

Release Code Coverage Packagist

This package extends the features of PHP DateTime and DateTimeZone classes to ease the handling of times, time zones and time zone locations. Getting the UTC or local representation of a time, formatting the time to a predefined format, accessing common properties such as day, month, year, quarter and more has been made especially easy. Also, all instances can be used as strings.

Installation

Usage

Let's say that now is "2013-02-03 21:03:45" in Paris:

Empty dates are also supported:

Acknowledgements

The implementation of the Time class.

Day of week

now() and right_now()

DateTime::now() returns a new instance with the current local time and the local time zone. Subsequent calls return equal times, event if they are minutes apart. now actually refers to the REQUEST_TIME or, if it is not available, to the first time the method was invoked.

On the other hand, DateTime::right_now() returns a new instance with the real current local time and the local time zone.

The following example demonstrates the difference:

Comparing DateTime instances

DateTime Instances are compared using standard comparison operations:

To determine if an instance is between two other instances you just need two comparisons:

To determine which instance is the most recent, or the most late, simply use PHP's min() and max() functions:

DateTime and JSON

Starting with v1.1.0, JsonSerializable interface and are serialized into ISO-8601 strings.

Changing multiple properties

The change() method is used to change multiple properties at once.

Note: Values exceeding ranges are added to their parent values.

Using the $cascade parameter, setting the hour resets the minute and second to 0, and setting the minute resets the second to 0.

Creating a new instance with changed properties

The with() method is similar to the change() method as it is used to define multiple properties at once, the difference is that the method creates a new instance, leaving the original instance intact.

Localized formatting

Localized formatting is outside of this package scope, still a localizer can be provided to the DateTime class to localize its instances, but of course the result depends on the implementation.

The following example demonstrates how to localize instances using ICanBoogie/CLDR which uses Unicode's Common Locale Data Repository to format DateTime instances.


Continuous Integration

The project is continuously tested by GitHub actions.

Tests

Contributing

Please see CONTRIBUTING for details.

License

ICanBoogie/DateTime is released under the BSD-3-Clause.


All versions of datetime with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package icanboogie/datetime contains the following files

Loading the files please wait ....