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

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

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

arokettu/date

最新稳定版本:2.4.0

Composer 安装命令:

composer require arokettu/date

包简介

Date class for PHP (without time)

README 文档

README

PHP License GitLab CI Codecov

A class for php to work with pure dates (without time).

Installation

composer require arokettu/date

Usage

The library:

<?php

use Arokettu\Date\Calendar;
use Arokettu\Date\Date;
use Arokettu\Date\JulianCalendar;
use Arokettu\Date\Month;

// creation
$date = Date::today(); // example: 2024-02-27
// or
$date = Calendar::create(2024, Month::February, 27);
// or
$date = Calendar::fromDateTime(new DateTime('Feb 27, 2024')); // truncates time
// or
$date = Calendar::parse('2024-02-27'); // Y-m-d is expected, years can be negative
// or
$date = Calendar::parseDateTimeString('Feb 27, 2024');

// alternative calendars
$date = JulianCalendar::parse('2024-02-14');

// getters
$date->getDay(); // 27
$date->getMonth(); // Month::February
$date->getMonthNumber(); // 2
$date->getYear(); // 2024
$date->getWeekDay(); // WeekDay::Tuesday
$date->getJulianDay(); // 2460368
$date->toDateTime(); // DateTimeImmutable('2024-02-27') // midnight in a default timezone
$date->toString(); // "2024-02-27"

// alternative calendar getters
$date->julian()->getDay(); // 14
$date->julian()->toString(); // "2024-02-14"

Documentation

Read full documentation here: https://sandfox.dev/php/date.html

Also on Read the Docs: https://php-date.readthedocs.io/

Support

Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/php-date/-/issues

Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community

License

The library is available as open source under the terms of the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-26