rodziu / datetimelocalized
PHP DateTime对象的本地化版本。
此包的官方仓库似乎已消失,因此该包已被冻结。
2.0.0
2018-04-19 09:00 UTC
Requires
- php: ^7.1
This package is not auto-updated.
Last update: 2023-02-10 14:18:20 UTC
README
允许用户以期望的区域设置正确地格式化PHP \DateTime
和 \DateTimeImmutable
对象。
此外,它将\DateTime
和 \DateTimeImmutable
构造函数异常转换为继承自 \RuntimeException
的 \Rodziu\DateTimeLocalized\DateTimeException
。
先决条件
- PHP 7.1+
安装
composer require rodziu/datetimelocalized
使用方法
<?php
\Rodziu\DateTimeLocalized\Config::setLocale('pl'); // sets desired locale, full list available at src/locale directory
(new \Rodziu\DateTimeLocalized\DateTime('2018-08-01'))->format('F M D l'); // returns "Sierpień Sie Śr Środa"
(new \Rodziu\DateTimeLocalized\DateTimeImmutable('2018-08-01'))->format('F M D l'); // returns "Sierpień Sie Śr Środa"