sergioccrr/datetimespanish

Translate textual date representations into Spanish

Maintainers

Package info

github.com/sergioccrr/datetimespanish

pkg:composer/sergioccrr/datetimespanish

Statistics

Installs: 85

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

v1.0 2021-10-24 18:16 UTC

This package is auto-updated.

Last update: 2026-04-10 03:50:00 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"