1. Go to this page and download the library: Download bangladatetime/php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bangladatetime / php example snippets
use BanglaDateTime\BanglaDateTime;
e with the current date and time, formatted in Bangla locale
$date = BanglaDateTime::create();
echo 'Current time with Bangla format: ' . $date->format('l jS F Y h:i:s');
echo '<br>';
// Create a BanglaDateTime instance with the current date and time, converted to the Bangla calendar
$date = BanglaDateTime::create();
echo 'Current time converted to Bangla: ' . $date->toBangla('l jS F Y h:i:s');
// Create a BanglaDateTime instance with a custom date ('2023-04-13'), formatted in Bangla locale
$date = BanglaDateTime::create('2023-04-13');
echo 'Set Time with Bangla format: ' . $date->format('l jS F Y h:i:s');
echo '<br>';
// Create a BanglaDateTime instance with a custom date ('2023-04-13'), converted to the Bangla calendar
$date = BanglaDateTime::create('2023-04-13');
echo 'Set Time & converted to Bangla: ' . $date->toBangla('l jS F Y h:i:s');
// Create a BanglaDateTime instance with the current time and a specific timezone ('Asia/Dhaka'), formatted in Bangla locale
$date = BanglaDateTime::create('now', 'Asia/Dhaka');
echo 'Set Time & Time Zone with Bangla format: ' . $date->format('l jS F Y h:i:s');
echo '<br>';
// Create a BanglaDateTime instance with the current time and a specific timezone ('Asia/Dhaka'), converted to the Bangla calendar
$date = BanglaDateTime::create('now', 'Asia/Dhaka');
echo 'Set Time & Time Zone & converted to Bangla: ' . $date->toBangla('l jS F Y h:i:s');