I need to convert Bangla Date to standard English date format. My bangle date :
$banglaDate = '৩১ ডিসেম্বর, ২০১৪ ইং ১০:৫৭ মিঃ';
And I need to convert this bangle date to standard English date ( 2014-12-31 10:57
)
Today is Monday, August 22, 2022 and Bengali date is Bhadro 5, 1429 Bangabda (সোমবার, ০৫ ভাদ্র, 1429 বঙ্গাব্দ).
The Bengali New Year, also known as Poila Boishakh (Pohela Boishakh), is decided according to the lunisolar calendar, which is entering this year in 1429. Poila Boishakh 1429 will be observed on 15 April 2022 as per the lunisolar calendar.
You can use the following step :
<?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
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With