Bangla date and time php script for any php base site

Bangla date and time php script for any php base site

Recently I have designed a bangle newspaper site where I have added a Date and time option. Now I am sharing It with you. It may be helpful to show Bangla date-time in your websites preferred place. To add simply add the following codes where you want to display current bangle date and time.

<?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;
}

define( 'MY_TIMEZONE', (get_option( 'timezone_string' ) ? get_option( 'timezone_string' ) : date_default_timezone_get() ) );
date_default_timezone_set( MY_TIMEZONE );
echo bn_date(date_i18n('l, d F Y, h:i a'));
?>

You can change date and time format by editing echo bn_date(date(‘l, d M Y, h:i a’));This enough. Now your site is bangle date and time enable. For more information please discus on comment section. For more interesting and necessary tips and trick don’t forget to share and follow 1stwebsuite.com 

Masum Billah has written 326 articles

Hi I am Md. Masum Billah Contributor of this website. I always like to share various things with other. In this website I am sharing web design related tips and tricks, necessary web development tools, source codes for beginner and advance web developer. You may join with us to help other who want to learn web design and development. Thank you for stay with.

Recommended Articles

One thought on “Password Generator PHP Snippet

  1. Haritha says:

    This blog is really informative. I gained more knowledge by reading your post. Thanks for providing us the useful information with us. Your blog is really helpful for me in attaining my knowledge in a right way.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>