PHPackages                             bangladatetime/php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bangladatetime/php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bangladatetime/php
==================

A PHP library to convert DateTime to Bangla format and Bangla calendar.

1.0.1(9mo ago)23491[2 PRs](https://github.com/BanglaDateTime/PHP/pulls)1MITPHPCI passing

Since Sep 12Pushed 3mo agoCompare

[ Source](https://github.com/BanglaDateTime/PHP)[ Packagist](https://packagist.org/packages/bangladatetime/php)[ RSS](/packages/bangladatetime-php/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (6)Used By (1)

BanglaDateTime
==============

[](#bangladatetime)

**BanglaDateTime** is a PHP library that allows you to easily format and convert DateTime to the Bangla calendar and Bangla number formats. It supports both current time and custom dates, as well as timezones.

Features
--------

[](#features)

- Convert DateTime to Bangla format.
- Convert to the Bangla calendar (Bengali Era).
- Supports custom dates and timezones.
- Easy to use with a fluent API.
- Helper functions for easy access to common operations.

Installation
------------

[](#installation)

You can install the package via [Composer](https://getcomposer.org/):

```
composer require bangladatetime/php
```

Usage
-----

[](#usage)

To use **BanglaDateTime**, you can create a new instance of the date and time with either the current time, a specific date, or a specific timezone.

### Basic Example

[](#basic-example)

```
use BanglaDateTime\BanglaDateTime;

require __DIR__ . '/vendor/autoload.php';

// Create a BanglaDateTime instance 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 '';

// 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');
```

**Output:**

```
Current time with Bangla format: বৃহস্পতিবার ১২ই সেপ্টেম্বর ২০২৪ ০৩:৩৭:০৩
Current time converted to Bangla: বৃহস্পতিবার ২৮শে ভাদ্র ১৪৩১ ০৩:৩৭:০৩

```

### Setting a Custom Date

[](#setting-a-custom-date)

You can also specify a custom date when creating the `BanglaDateTime` instance:

```
// 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 '';

// 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');
```

**Output:**

```
Set Time with Bangla format: বৃহস্পতিবার ১৩ই এপ্রিল ২০২৩ ১২:০০:০০
Set Time & converted to Bangla: বৃহস্পতিবার ৩০শে চৈত্র ১৪২৯ ১২:০০:০০

```

### Working with Timezones

[](#working-with-timezones)

You can also pass a timezone when creating the `BanglaDateTime` instance:

```
// 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 '';

// 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');
```

**Output:**

```
Set Time & Time Zone with Bangla format: বৃহস্পতিবার ১২ই সেপ্টেম্বর ২০২৪ ০৯:৩৭:০৩
Set Time & Time Zone & converted to Bangla: বৃহস্পতিবার ২৮শে ভাদ্র ১৪৩১ ০৯:৩৭:০৩

```

API
---

[](#api)

### `BanglaDateTime::create($time = 'now', $timezone = 'UTC')`

[](#bangladatetimecreatetime--now-timezone--utc)

Creates a new `BanglaDateTime` instance.

- **`$time`**: The date and time to use (optional, defaults to `'now'`).
- **`$timezone`**: The timezone to use (optional, defaults to `'UTC'`).

### `format($format)`

[](#formatformat)

Formats the date and time using a specified format, with the output in the Bangla locale.

- **`$format`**: The format string (same as PHP's `DateTime::format`).

### `toBangla($format)`

[](#tobanglaformat)

Converts and formats the date and time into the Bangla calendar and Bangla numbers.

- **`$format`**: The format string (same as PHP's `DateTime::format`).

Helper Functions
----------------

[](#helper-functions)

**BanglaDateTime** provides the following global helper functions for easy access:

- **`bangla_date_time($time = 'now', $timezone = 'UTC')`**: Creates a new `BanglaDateTime` instance.

    ```
    $date = bangla_date_time('2023-04-13', 'Asia/Dhaka');
    ```
- **`format_bangla_date($format, $time = 'now', $timezone = 'UTC')`**: Formats a date/time in Bangla format.

    ```
    echo format_bangla_date('l jS F Y h:i:s');
    ```
- **`convert_to_bangla_calendar($format, $time = 'now', $timezone = 'UTC)`**: Converts a date/time to Bangla calendar format.

    ```
    echo convert_to_bangla_calendar('l jS F Y h:i:s');
    ```

Contributing
------------

[](#contributing)

Feel free to contribute by submitting a pull request or opening an issue. Your contributions are highly appreciated!

License
-------

[](#license)

This library is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance70

Regular maintenance activity

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~162 days

Total

3

Last Release

289d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a6975c50488b3eeb7cb613bf0b280342ce3912dc4ffaa1aa14b75add8fe070a?d=identicon)[rtraselbd](/maintainers/rtraselbd)

---

Top Contributors

[![rtraselbd](https://avatars.githubusercontent.com/u/31556372?v=4)](https://github.com/rtraselbd "rtraselbd (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

datetimeBangladate-conversionbangladeshBangla Calendar

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bangladatetime-php/health.svg)

```
[![Health](https://phpackages.com/badges/bangladatetime-php/health.svg)](https://phpackages.com/packages/bangladatetime-php)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[morilog/jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in PHP applications, based on Jalali (Shamsi) DateTime class.

9201.2M45](/packages/morilog-jalali)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
