I have worked with Bangla date a long time ago. The first initiative was to make a extension for forum engine punBB. After that, i made a javascript widget to display Bangla date in any site. The third initiative was to make a facebook application that shows current Bangla date to your facebook profile.
I always wanted to publish this as a PHP Class but never got that chance to do so. After a long time i worked with Bangla date today and finally created a PHP Class to use it anywhere by anyone. Sorry for the late.
Usage:
[php]
<?php
include_once ‘class.banglaDate.php’;
$bn_date = new BanglaDate(time());
$date = $bn_date->get_date();
?>
[/php]
You will get an array of converted date in Bangla.
A few things needed to know. Bangla date counted or changes after the sun rise. That means, where English date changes at 12’O clock at the night, Bangla date changes at the morning after the sunrise.
Class Constructor:
This class constructor has 2 parameters. The first one in timestamp and the second one is the hour of changing the date. If you want to change the Bangla date like English at 12’0 clock at the night, you should use $bn_date = new BanglaDate(time(), 0)
. But if you want to change the date at 6’O clock at the morning, use as $bn_date = new BanglaDate(time(), 6)
. If you don’t pass the second parameter, the default value is 6. Use as you like.
After Creating the class object, you can set another date using set_time()
like $bn_date->set_time(time(), 4);
Great, now you made it easier. will use it whenever i have to…
Thanks Junal vai. Yeah, use it whenever it needs 😀
Nice! Thanks vai!
Great work. Thanks.
But you made same mistake again. Spelling mistake of “অগ্রহায়ন“.
হায় হায়, এখনি ঠিক করে দিচ্ছি। ধন্যবাদ জানানোর জন্যে
That’s great man. I will try to use this with a joomla plugin to show bangla calender date with it.
Yeah, sure 😀
I have added ur fb application on my fb profile. thanks for creating this.
Wow!!!
Great work! At past I thought that you are going to be a PHP Guru. But after doing this great work (I mean now), now you are really a PHP Guru. 🙂
Thanks
Great work!
I’ll test it tonight.
gr8 work!
Works fine.
I’m testing here.
http://khulnajournal.com/
Just one thing, Date converts assuming Bangladesh time as GMT+7.
when i use this class bangla fonts displayed as unknown Symbol.
I use Font SolaimanLipi as unicode font . So how can i use ur class as unicode fonts.
ভাই আজ তো ২৮ ফাল্গুন ১৪১৮ , কিন্তু এটা দেখায় ২৭ ফাল্গুন। লিপ-ইয়ারের জন্য কি সমস্যাটা হলো?
ভাই দয়া করে এটা সমাধান করে দেন, আমি আপনার জাভাস্ক্রিপ্ট কোড টা ব্যবহার করি।
It’s fixed now. Thanks for reporting 🙂
অনেক ধন্যবাদ ভাই।
আরেকটা সাহায্য চাইবো, আমি পিএইচপি কোডটা রান করালে এমন আসেঃ Array ( [0] => ২৮ [1] => ফাল্গুন [2] => ১৪১৮ )
কিন্তু আপনারটা আসে এভাবেঃ document.write(‘আজ ২৮ ফাল্গুন ১৪১৮ বঙ্গাব্দ’);
document.write(‘আজ ২৮ ফাল্গুন ১৪১৮ বঙ্গাব্দ’); এভাবে আনতে হলে কি করতে হবে, যদি সময় হয় তাহলে একটু সাহায্য করবেন প্লিজ।
ইয়াহু………
হয়ে গেছে ভাই, একটু অন্য ভাবে করেছি, এরের মাধ্যমে রিটার্ন না করে অন্য ভাবে করলাম, দারুন কাজ করছে।
আবারো ধন্যবাদ এতো ভালো একটা কাজ ওপেন করে দেওয়ার জন্য।
এখন থেকে আমি নিজের হোস্ট থেকেই বাংলা তারিখ দেখাতে পারবো……
can you please tell how will i be able to print as “২৮ ফাল্গুন ১৪১৮” format NOT in a array like “Array ( [0] => ২৮ [1] => ফাল্গুন [2] => ১৪১৮ )”
[php]$bn = new BanglaDate(time(), 0);
$bdt = $bn->get_date();
$text = sprintf( ‘আজ %s’, implode( ‘ ‘, $bdt ) );
echo $text;[/php]
thanks a lot 🙂
Tareq vai,
i used
$bn = new BanglaDate(time(), 0);
but the date still not changing at 12′ o’clock
can you help?
Hello,
I have a problem when i run this script in my IIS server.
Here output screenshot: http://s10.postimg.org/oxr4o4nrt/sublime.png
how can i solve this problem?
my server config:
OS: Windows 8
Server IIS 8
PHP Version: 5.4.13
Please give me some solution.
Thanks for this great work.
My problem get solved. can you help me to show time in bangla?
Thank you very much for the class…
I would like to know, how do I used bengali letter in web i mean integrate bangla into web site…
I used unicode but not worked in Linux server…
rgds, Mamun
nice works, thanks for share
দারুন একটা পোষ্ট। তবে আমার একটা পিএইচপি নিউজ সাইটের জন্য ইংরেজী, বাংলা এবং আরবী তারিখ বাংলাতে দেখানো প্রয়োজন ছিল। সেজন্য আমি অনলাইনে আরো কিছু স্ক্রীপ্ট পেয়েছি। সেগুলোও দারুন কাজ করছে। যেমনঃ
tareq bhai এক দিন বেশী হচ্ছে কেন? যেমন আজ ৪ বৈশাখ ১৪২১ দেখাচ্ছে কিন্তু আজ ৩রা বৈশাখ ১৪২১
কারণ আজকে ৪ তারিখ, ৩ তারিখ না 😉
দয়া করে এই সাইট টা দেখলে আপনার তারিখের পার্থক্য বুঝতে পারবেন-
http://www.kanchanmoni.com/baisakh.html
কলকাতার বাংলা তারিখ আর বাংলাদেশের মধ্যে পার্থক্য আছে। বাংলা একাডেমির হিসাব অনুযায়ী বাংলা তারিখকে নির্দিষ্ট করে দেয়া হয়েছে, অপরদিকে কলকাতায় চাঁদের উপর ভিত্তি করে বাংলা তারিখ নির্ধারণ করা হয়। এখানেই গোলমাল পেকেছে।
I had installed the Bangla date class and it was working perfectly. In the last few days it is displaying some characters like আজ ১৫ জà§à¦¯à§ˆà¦·à§à¦ ১৪২১ বঙà§à¦—াবà§à¦¦ ( http://www.ettrika.com/ettrika-display.php ) . even the direct link http://tareq.wedevs.com/bangla_date_widget.php is displaying the same. I am using
Also, Download Bangla Date Class above this page is not working. Could you please guide us. Is there a way to have the class and run it without direct URL link ?
Works perfectly here.

May be you didn’t include the meta tag in your html page? [html][/html][html][/html]
I could’t find the class.Can you please give me a link for download the class?
১৩ রবিউল আউয়াল please help for this example
my result this
বুধবার, 7 জানুয়ারি 2015, 8:30:11
But i want to
বুধবার, ৭ জানুয়ারী ২০১৫, ৮ঃ৩০ঃ১১
thanks
may be you can use
str_replace()
for that.Sir I am sorry for saying that ,
I used this without your permission in a tutorial.
https://phpans.com/bangla-date-and-time-in-php
sorry for that.
No problem using the code, but mentioning the link to the original code would help others to find out the source and the original author will be happy too 🙂
I am showing bangla blog site post date(time_ago();)function but one problem only show 2 .i want to show bengle font that like(২)—plz help
You want see the tips of win Klik here https://shamimnasir.com/