8 Jul 2020
PHP

Nepali Date: PHP Composer Package for Nepali Date Converter and Utilities

Nepali Date is a PHP composer package for Nepali to English Date converter. In Nepal, Bikram Sambat (BS) date is used and we frequently need to convert BS date to AD date. This package provides helper class and methods for the purpose. Instructions for installation and usages examples are given below.

Github Link: Github

Installation

Use Composer to install the package. If you have not setup Composer in your machine, please visit Get Composer first.

composer require ernilambar/nepali-date

Use following to include autoload file in your project.

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

Usage

Usage examples:

use Nilambar\NepaliDate\NepaliDate;

$obj = new NepaliDate();

// Convert BS to AD.
$date = $obj->convertBsToAd('2077', '1', '1');

// Convert AD to BS.
$date = $obj->convertAdToBs('2020', '1', '1');

// Get Nepali date details by BS date.
$date = $obj->getDetails('2077', '1', '1', 'bs');

// Get Nepali date details by AD date.
$date = $obj->getDetails('2020', '1', '1', 'ad');

If you have any queries or feedback or if you find bug, please feel free to create issue in the GitHub repo.

Nilambar

PHP Programmer, WordPress and Laravel Developer, Freelancer and a Blogger.

View all posts by Nilambar →

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.