Skip to content

krishnahimself/laravel-ad-to-bs-converter

Repository files navigation

Laravel AD to BS Converter

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This package can convert english date to nepali date.

Here is one example of what you can do:

Convert english date to nepali date. English date format to pass is (YYYY, M, D)

DateConverter::fromEnglishDate(2020, 10, 4)->toFormattedNepaliDate();
//Output: १८ असोज २०७७, आइतवार

Installation

You can install the package via composer:

composer require krishnahimself/laravel-ad-to-bs-converter

Usage

use Krishnahimself\DateConverter\DateConverter;

$nepaliDate = DateConverter::fromEnglishDate(2020, 10, 4)->toNepaliDate();
//Output: 2077-6-18

$nepaliDate = DateConverter::fromEnglishDate(2020, 10, 4)->toFormattedNepaliDate();
//Output: १८ असोज २०७७, आइतवार

$nepaliDate = DateConverter::fromEnglishDate(2020, 10, 4)->toNepaliDateArray();
//Output:
[
    'year' => 2077,
    'month' => 6,
    'day' => 18,
    'day_of_week' => 1,
]

$nepaliDate = DateConverter::fromEnglishDate(2020, 10, 4)->toFormattedNepaliDateArray();
//Output:
[
    'year' => '२०७७',
    'month' => 'असोज',
    'day' => '१८',
    'day_of_week' => 'आइतवार',
]

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Convert English date to Nepali date.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages