Question

Je me demandais s'il y a un moyen, en utilisant PHP, pour changer ce format de date: 08.01.86 (8 Janvier, 1986) à ce format. 08.01.86

Était-ce utile?

La solution

<?php

$date = "01.08.86";
$unix = strtotime($date);
echo date('n.j.y', $unix);

Autres conseils

Qu'en est-il une solution regex:

$str = '01.08.86';
$a = array('/^0(\d+)/','/\.0(\d+)/');
$b = array('\1','.\1');
$str = preg_replace($a,$b,$str);

// $str is now '1.8.86'
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top