Last active
May 30, 2020 23:18
-
-
Save ratulkuri/8834dec2b0877d46fe0e8450e298c9d1 to your computer and use it in GitHub Desktop.
Translate Dates English to Bangla in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if(!function_exists("date_entobd")){ | |
| function date_entobd($date, $format = "l, F j, Y"){ | |
| $inputDate = date($format, strtotime($date)); | |
| $enDate = ['1','2','3','4','5','6','7','8','9','0','January','February','March','April', | |
| 'May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec','Saturday','Sunday', | |
| 'Monday','Tuesday','Wednesday','Thursday','Friday','Sat','Sun','Mon','Tue','Wed','Thu','Fri']; | |
| $bdDate = ['১','২','৩','৪','৫','৬','৭','৮','৯','০','জানুয়ারী','ফেব্রুয়ারী','মার্চ','এপ্রিল','মে', | |
| 'জুন','জুলাই','আগস্ট','সেপ্টেম্বর','অক্টোবর','নভেম্বর','ডিসেম্বর','জানুয়ারী','ফেব্রুয়ারী','মার্চ','এপ্রিল','মে', | |
| 'জুন','জুলাই','আগস্ট','সেপ্টেম্বর','অক্টোবর','নভেম্বর','ডিসেম্বর','শনিবার','রবিবার','সোমবার','মঙ্গলবার',' | |
| বুধবার','বৃহস্পতিবার','শুক্রবার','শনি','রবি','সোম','মঙ্গল','বুধ','বৃহস্পতি','শুক্র']; | |
| $translatedDate = str_replace($enDate, $bdDate, $inputDate); | |
| return $translatedDate; | |
| } | |
| } | |
| // echo date_entobd($timestamp, "M d, Y"); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment