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 include_once 'class.banglaDate.php'; $bn_date = new BanglaDate(time()); $date = $bn_date->get_date(); ?>
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);
Bangla Date class on PHPClasses.org
Great, now you made it easier. will use it whenever i have to…
Thanks Junal vai. Yeah, use it whenever it needs
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] => ১৪১৮ )”
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?