rodziu/datetimelocalized

Localized version of PHP DateTime objects.

This package's canonical repository appears to be gone and the package has been frozen as a result.

2.0.0 2018-04-19 09:00 UTC

This package is not auto-updated.

Last update: 2023-02-10 14:18:20 UTC


README

Allows one to properly format PHP \DateTime and \DateTimeImmutable objects in desired locale.

Additionaly it converts \DateTime and \DateTimeImmutable constructor exceptions to \Rodziu\DateTimeLocalized\DateTimeException that inherits from \RuntimeException.

Prerequisites

  • PHP 7.1+

Installation

composer require rodziu/datetimelocalized

Usage

<?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"