Created
May 15, 2014 19:06
-
-
Save sasajib/141a2b860522da04045f to your computer and use it in GitHub Desktop.
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
| //These are integrated in BaseModel as methods ... not a full class | |
| public function convertDateTimeToJs($dateTime) | |
| { | |
| $date = DateTime::createFromFormat('Y-m-d H:i:s', $dateTime); | |
| return $date->format('M d, Y h:i:s A'); | |
| } | |
| public function convertToBanglaDate($inputDate) | |
| { | |
| $eng = [ | |
| 1,2,3,4,5,6,7,8,9,0, | |
| 'Jan', 'Feb','Mar', | |
| 'Apr','May','Jun','Jul','Aug', | |
| 'Sep','Oct','Nov', | |
| 'Dec','Saturday','Sunday', | |
| 'Monday','Tuesday','Wednesday', | |
| 'Thursday','Friday' | |
| ]; | |
| $bang = [ | |
| '১','২','৩','৪','৫','৬','৭','৮','৯','০', | |
| 'জানুয়ারী','ফেব্রুয়ারী','মার্চ', | |
| 'এপ্রিল','মে','জুন','জুলাই','আগস্ট', | |
| 'সেপ্টেম্বর','অক্টোবর','নভেম্বর', | |
| 'ডিসেম্বর','শনিবার','রবিবার', | |
| 'সোমবার','মঙ্গলবার','বুধবার', | |
| 'বৃহস্পতিবার','শুক্রবার' | |
| ]; | |
| return str_replace($eng, $bang, $inputDate); | |
| } | |
| public function convertToBanglaNumber($inputValue) | |
| { | |
| $bang = ['০','১','২','৩','৪','৫','৬','৭','৮','৯']; | |
| return str_replace(range(0, 9),$bang, $inputValue); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment