At first create a file suppose bangladate.php, then open it by a text editor, suppose: Notepad++
Then paste this below code and save
<?php
function bn_date($str)
{
$en = array(1,2,3,4,5,6,7,8,9,0);
$bn = array('১','২','৩','৪','৫','৬','৭','৮','৯','০');
$str = str_replace($en, $bn, $str);
$en = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
$en_short = array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
$bn = array( 'জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর' );
$str = str_replace( $en, $bn, $str );
$str = str_replace( $en_short, $bn, $str );
$en = array('Saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday');
$en_short = array('Sat','Sun','Mon','Tue','Wed','Thu','Fri');
$bn_short = array('শনি', 'রবি','সোম','মঙ্গল','বুধ','বৃহঃ','শুক্র');
$bn = array('শনিবার','রবিবার','সোমবার','মঙ্গলবার','বুধবার','বৃহস্পতিবার','শুক্রবার');
$str = str_replace( $en, $bn, $str );
$str = str_replace( $en_short, $bn_short, $str );
$en = array( 'am', 'pm' );
$bn = array( 'পূর্বাহ্ন', 'অপরাহ্ন' );
$str = str_replace( $en, $bn, $str );
return $str;
}
//Change below codes according to your requirement .
//__________________________________________
echo bn_date(date('l, d M Y, h:i a'));
//__________________________________________
?>
Now, paste the below code , where you want to show
<?php
include_once"/wp-content/themes/deshtimes/bndate.php"; ?>
red color will be your file url/link.
Then paste this below code and save
<?php
function bn_date($str)
{
$en = array(1,2,3,4,5,6,7,8,9,0);
$bn = array('১','২','৩','৪','৫','৬','৭','৮','৯','০');
$str = str_replace($en, $bn, $str);
$en = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
$en_short = array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
$bn = array( 'জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর' );
$str = str_replace( $en, $bn, $str );
$str = str_replace( $en_short, $bn, $str );
$en = array('Saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday');
$en_short = array('Sat','Sun','Mon','Tue','Wed','Thu','Fri');
$bn_short = array('শনি', 'রবি','সোম','মঙ্গল','বুধ','বৃহঃ','শুক্র');
$bn = array('শনিবার','রবিবার','সোমবার','মঙ্গলবার','বুধবার','বৃহস্পতিবার','শুক্রবার');
$str = str_replace( $en, $bn, $str );
$str = str_replace( $en_short, $bn_short, $str );
$en = array( 'am', 'pm' );
$bn = array( 'পূর্বাহ্ন', 'অপরাহ্ন' );
$str = str_replace( $en, $bn, $str );
return $str;
}
//Change below codes according to your requirement .
//__________________________________________
echo bn_date(date('l, d M Y, h:i a'));
//__________________________________________
?>
Now, paste the below code , where you want to show
<?php
include_once"/wp-content/themes/deshtimes/bndate.php"; ?>
red color will be your file url/link.
Result: বৃহস্পতিবার, ০2 ফেব্রুয়ারী ২০১৩, ০৭:৩৯ অপরাহ্ন
you can change the pattern by
echo bn_date(date('l, d M Y, h:i a'));
echo bn_date(date('l, d M Y, h:i a'));
l=Day in full text
D=Day in short text
Y=Year
M=Month in full text
d=Day in Numeric format
h=Hour in Numeric
i=Minute in Numeric
a=Time in text like "AM and PM , in bangla
'পূর্বাহ্ন', 'অপরাহ্ন'
"
D=Day in short text
Y=Year
M=Month in full text
d=Day in Numeric format
h=Hour in Numeric
i=Minute in Numeric
a=Time in text like "AM and PM , in bangla
'পূর্বাহ্ন', 'অপরাহ্ন'
"
Check also:
ReplyDeletehttp://hasibtutorial.blogspot.com/2013/01/showing-date-in-bangla-to-your-website.html