vascowhite/datefactory 问题修复 & 功能扩展

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

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

vascowhite/datefactory

最新稳定版本:v1.1.1

Composer 安装命令:

composer require vascowhite/datefactory

包简介

A factory class for DateTime objects.

关键字:

README 文档

README

#DateFactory A factory for \DateTime objects with checks that the date string supplied matches the format supplied.

##Installation Install using composer, add the following to composer.json:-

"require": {
    "vascowhite/datefactory": "v1.1.x"
}

##Why Because \DateTime::createFromFormat() does stupid things and I needed a way of doing server side validation on user supplied dates.

##DateFactory There is just one public method:

####DateFactory::getDate() Signature:-

DateTime DateFactory::getDate(String $date, String $format, [String $timeZone])

Arguments $date is a string representing a date/time, e.g. '2014-14 14:12:10'. $format Format string. Available formats are any available for \DateTime::createFromFormat(). $timeZone Optional. A valid Time Zone identifier from this list.

Example

$dateTime = DateFactory::getDate('2014-12-25 12:00:00',  'Y-m-d H:i:s', 'Europe/London');

Return Returns a DateTime object or false on failure.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2014-12-01