承接 magroski/time-buddy 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

magroski/time-buddy

最新稳定版本:v1.0.2

Composer 安装命令:

composer require magroski/time-buddy

包简介

A library to handle time and date interval

README 文档

README

Latest Stable Version Minimum PHP Version CircleCI GitHub license

This library provides some syntax sugar around time and date manipulation, including on-the-fly format localization without the need to add multiple locales to your environment.

Locales are available on the folder src/Provider. Pull-requests are welcome.

Usage examples

Creation

# Default
$time = new Time();

# From unix timestamp
$time = Time::createFromUnixTstamp(time());

# From DateTime
$dateTime = new \DateTime();
$time = Time::createFromDateTime($dateTime);

# From DateTimeImmutable
$immutable = new \DateTimeImmutable();
$time = new Time($immutable);

Operations (Time is immutable, so operations generate new objects)

$firstTime = new Time();

$secondTime = $firstTime->add(100);

$thirdTime = $firstTime->subtract(100);

Formatting

$time = new Time();
$time->format('d F Y'); # 20 May 2019

$time->setLocale('pt_BR');
$time->format('d F Y'); # 20 Maio 2019

Generating a Date Interval

$time = new Time();
$laterTime = new Time();

# From Time
$interval = $time->diff($laterTime);

# Staticaly
$interval = DateInterval::createFromTime($time, $laterTime);

# Staticaly from a single time
$interval = DateInterval::createFromTime($time); # Second argument is current time

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固