Parse french date in php

前端 未结 6 1120
南笙
南笙 2021-01-18 09:55

I have string:

\"Lundi, 08 Juillet 2013 09:09\"

How can I parse this type string?

I try:

    $date = \'08 Juillet 2013 09:0         


        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-18 10:15

    If your format is fixed, use strptime in combination with French locale:

    date_default_timezone_set("UTC");
    setlocale(LC_ALL, 'fr_FR');
    $date = '08 Juillet 2013 09:09';
    $date = strptime($date, '%d %B %Y %H:%M'); 
    var_dump($date);
    

    See strftime for description of format string.

提交回复
热议问题