sergioccrr / datetimespanish
Translate textual date representations into Spanish
v1.0
2021-10-24 18:16 UTC
Requires
- php: >=7.4.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-10 00:08:14 UTC
README
A simple extension of the native DateTime class that allows to represent months and days of the week in Spanish.
Motivation
You can achieve this with the setlocale
function, but it relies on you having the locale installed on your system, plus to being an ugly global setting.
Example
<?php echo (new DateTimeSpanish)->setDate(2020, 1, 6)->format('l, d F Y'); // Return "Lunes, 06 Enero 2020" // Instead of: echo (new DateTime)->setDate(2020, 1, 6)->format('l, d F Y'); // Return "Monday, 06 January 2020"