Documentation

introduction

Usage

Installation

Before you start using LaravelNepaliDate, make sure it's installed in your project. You can include it using composer as described in the Installation section of the documentation.

Convert English date to Nepali date:

Provide an English date, and effortlessly convert it to the Nepali date format.

$convertedNepaliDate = LaravelNepaliDate::from($engDate)->toNepaliDate();
// Result: 2053-01-10

Format Nepali date:

Format the Nepali date according to your preferences, making it suitable for display in a user-friendly format.

$formattedNepaliDate = LaravelNepaliDate::from('1996-04-22')->toFormattedNepaliDate();
// Result: резреж рд╡реИрд╢рд╛рдЦ реирежрелрей, рд╕реЛрдордмрд╛рд░

Convert Nepali date to English date:

Input a Nepali date, and smoothly convert it to the corresponding English date.

$convertedEnglishDate = LaravelNepaliDate::from('2053-01-10')->toEnglishDate();
// Result: 1996-04-22

Format English date:

Format the English date in a way that suits your application's design and user experience.

$formattedEnglishDate = LaravelNepaliDate::from('2053-01-10')->toFormattedEnglishDate();
// Result: 22 April 1996, Monday

Additional Details:

  • Custom Formatting:
    All of the above methods accept optional $format parameters. Customize the date output by providing your desired format string.
  • Locale Specification:
    Specify the locale using the optional $locale parameter, with values 'np' for Nepali and 'en' for English. This allows you to handle dates in different languages and regions seamlessly.

Feel free to experiment with various formats and locales to suit your application's specific requirements. The supported format strings/characters are provided in the Formatting section of the documentation. Laravel Nepali Date Converter provides flexibility in adapting to diverse date display needs within your Laravel projects.