0

i have this french date format :

(Samedi, Aout 31, 2013)

and i want to get only the (M) of the date, for example for August i only want the (Aug)

PS : August in english = Aout in french

4

3 回答 3

1
<?php
  $date = 'Samedi, Aout 31, 2013';
  $time = strtotime($date);
  $month_only = date('M', $time);
  echo $month_only;
于 2013-08-22T23:43:22.440 回答
0
$stamp = strtotime("Samedi, Aout 31, 2013");
$month = strftime("%b", $stamp);

...或更简洁地说:

echo strftime("%b", strtotime("Samedi, Aout 31, 2013"));
于 2013-08-22T23:45:48.263 回答
0

尝试:explode(" ","Samedi, Aout 31, 2013")[1]

于 2013-08-22T23:58:02.277 回答