定制 utcdatetime/utcdatetime 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

utcdatetime/utcdatetime

最新稳定版本:1.1.1

Composer 安装命令:

composer require utcdatetime/utcdatetime

包简介

Provides a datetime-implementation that is always UTC

README 文档

README

A small library that always uses UTC for your DateTime-Objects no matter what you input.

Build Status Code Climate Scrutinizer Code Quality

Installation

UTCDateTime is installed via composer. Call composer require utcdatetime/utcdatetime from the commandline in your project.

Alternatively you can include the following line in your composer.json inside the require-section:

"utcdatetime/utcdatetime" : "stable"

Usage

Use the UTCDateTime- or UTCDateTimeImmutable-Object just like PHPs own DateTime-Objects. You do not have to rewrite any productive code. Just add use UTCDateTime/DateTime resp. use UTCDateTime\DateTimeimmutable to the use-section of your PHP-file. That will cause PHP to use the UTCDateTime-Objects instead of the PHP-Internal DateTime-Objects.

Calls to setTimeZone will be ignored, all other calls will be executed just as before. The only difference will be, that no matter what you put into the DateTime-Objects, it will always contain the UTC-representation of your date. And there is no way to change that.

So any Datetime-data will always be correctly converted to UTC and you can then work with that like so:

use UTCDateTime\DateTime;
$date = new DateTime('2014-11-03 12:34:56', new DateTimeZone('Europe/Berlin'));
echo $date->format(DateTime::RFC3339);
// 2014-11-03T10:34:56+00:00

Additional Constants

This package also introduce some more formating-constants.

Those include:

  • DateTime::RFC7231 for formatting date according to RFC 7231
  • DateTime::PDF for formatting dates for internal PDF-Storage

Licence

This code is licensed under the MIT-License.

Contributing

Contributions are always welcome. Fork the repo, do whatever you like and open a pull request!

统计信息

  • 总下载量: 28
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固