Documentation

examples

Helper Function

Laravel Nepali Date Converter provides convenient helper functions for quick and easy date conversions. These functions streamline the process of converting between English (A.D.) and Nepali (B.S.) dates, offering simplicity and efficiency in your Laravel projects.

Convert English Date to Nepali Date (B.S.)

Use the toNepaliDate helper function to effortlessly convert an English date to its Nepali equivalent. Simply provide the English date as a string in the format "YYYY-MM-DD" or "YYYY/MM/DD."

// Convert English date to Nepali date (B.S.).
toNepaliDate("1996-04-22") 
// Result: 2053-01-10

This function returns the Nepali date in the default format, providing a seamless way to integrate date conversion into your application.


Convert Nepali Date to English Date (A.D.)

Similarly, the toEnglishDate helper function allows you to convert a Nepali date to its English counterpart. Provide the Nepali date in the format "YYYY-MM-DD" or "YYYY/MM/DD."

// Convert Nepali date to English date (A.D.).
toEnglishDate("2053-01-10") 
// Result: 1996-04-22

This function returns the English date in the default format, simplifying the process of handling dates in your Laravel projects.


Conclusion

The helper functions provided by Laravel Nepali Date Converter offer a straightforward and efficient way to handle date conversions in your Laravel applications. Whether you need to convert English dates to Nepali or vice versa, these functions make it easy to integrate date functionality seamlessly.