2014-12-31 153 views
5

我需要轉換孟加拉日期標準英文日期格式。我的手鐲日期:將孟加拉日期轉換爲標準英文日期

$banglaDate = '৩১ ডিসেম্বর, ২০১৪ ইং ১০:৫৭ মিঃ'; 

,我需要這個手鐲日期轉換爲標準的英語日期(2014-12-31 10:57

回答

10

您可以使用下面的步驟:

<?PHP 
    $banglaDate = '৩১ ডিসেম্বর, ২০১৪ ইং ১০:৫৭ মিঃ'; 

    $search_array= array("১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯", "০", "জানুয়ারী", "ফেব্রুয়ারী", "মার্চ", "এপ্রিল", "মে", "জুন", "জুলাই", "আগষ্ট", "সেপ্টেম্বার", "অক্টোবার", "নভেম্বার", "ডিসেম্বার", ":", ","); 

    $replace_array= array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ":", ","); 

    // convert all bangle char to English char 
    $en_number = str_replace($search_array, $replace_array, $banglaDate); 

    // remove unwanted char  
    $end_date = preg_replace('/[^A-Za-z0-9:\-]/', ' ', $en_number); 

    // convert date 
    $bangla_date = date("Y-m-d H:i ", strtotime($end_date)); 

    // output : 2014-12-31 10:57 
?> 
+1

哦,所以它不是實際使用孟加拉日曆,這只是在孟加拉寫的格里高利日期。我認爲這是一個日曆轉換問題,而不是簡單的音譯問題。 –

相關問題