-1

I'm trying to display the 3 first letter of the month in french, that was stored in US format in my wordpress custom field. The code below print the correct date but not in french !

$date = get_field('event_date');
$y = substr($date, 0, 4);
$m = substr($date, 4, 2);
$d = substr($date, 6, 2);
setlocale(LC_TIME, "fr_FR");
$time = strtotime("{$d}-{$m}-{$y}");
echo date('M', $time);
Alex
  • 81
  • 1
  • 10

1 Answers1

0

You should use

strftime('%b', $time) 

instead of the date function.

See also http://php.net/manual/en/function.strftime.php

jhnbrn
  • 211
  • 1
  • 7