robier/date 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

robier/date

Composer 安装命令:

composer require robier/date

包简介

Simple date implementation of ISO 8601 standard

README 文档

README

Simple date implementation of ISO 8601 standard.

Build Status Test Coverage

Introduction

The Date class follows the ISO 8601 standard for representing date.

Also allows easy getting range of two dates.

Installation

You can install this library with composer.

composer require robier/date

Requirements

This library requires PHP 7.1.

Overview

This library contains of 3 classes:

  • Date - representation of actual date
  • Date\Factory - factory for creating Date object in different ways
  • Date\Range - generator that represents range between 2 dates

Samples

Creating new instance of Date (various ways how to get date 1991-11-14):

use Robier\Date;

$date = new Date(1991, 11, 14); // or
$date = Date/Factory::new(1991, 11, 14); // or
$date = Date/Factory::dateTime(DateTime::createFromFormat('Y-m-d', '1991-11-14')); // or
$date = Date/Factory::string('1991-11-14'); // or
$date = Date/Factory::iso(1991, 46, 4);

Get today date:

$today = Date/Factory::today();

Get tomorrows date:

$tomorrow = Date/Factory::tomorrow(); // or
$tomorrow = Date/Factory::today()->next();

Get yesterday date:

$yesterday = Date/Factory::yesterday(); // or
$yesterday = Date/Factory::today()->previous();

Get any date in future of provided date (ie. 5 days after 1991-11-14):

$date = new Date(1991, 11, 14);
$date->next(5);

Get any date in past of provided date (ie. 6 days before 1991-11-14):

$date = new Date(1991, 11, 14);
$date->previous(6);

Range between 2 dates (ie. get dates between 1991-11-14 and 1991-12-01):

$start = new Date(1991, 11, 14);
$end = new Date(1991, 12, 1);

$range = new Date\Range($start, $end); // or
$range = $start->to($end);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固