rawphp/raw-datetime

RawDateTime is a wrapper with useful utility functions around the DateTime class and is used by RawPHP framework and other applications.

dev-master / 0.x-dev 2014-12-16 06:25 UTC

This package is auto-updated.

Last update: 2024-04-20 07:21:51 UTC


README

Build Status

Package Features

  • User to UTC time conversion
  • UTC to User time conversion
  • Get span between two dates in years, months, weeks, days, hours, minutes and seconds

Installation

Composer

RawDateTime is available via Composer/Packagist.

Add "rawphp/raw-datetime": "0.*@dev" to the require block in your composer.json and then run composer install.

{
        "require": {
            "rawphp/raw-datetime": "0.*@dev"
        }
}

You can also simply run the following from the command line:

composer require rawphp/raw-datetime "0.*@dev"

Tarball

Alternatively, just copy the contents of the RawDateTime folder into somewhere that's in your PHP include_path setting. If you don't speak git or just want a tarball, click the 'zip' button at the top of the page in GitHub.

Basic Usage

<?php

use RawPHP\RawDateTime\DateTime;

// get UTC time from local
$utc = DateTime::getUtcDateTime( new \DateTime( ) );

// get local time from UTC
$local = DateTime::getUserDateTime( $utc );

License

This package is licensed under the MIT. Read LICENSE for information on the software availability and distribution.

Contributing

Please submit bug reports, suggestions and pull requests to the GitHub issue tracker.

Changelog

22-09-2014

  • Updated to PHP 5.3.

21-09-2014

  • Initial Code Commit
  • Removed DateTimeInterface because it was added in PHP 5.5