# Laravel: How to Implement HamroPatro API for Nepali Date Conversion

By Dinesh Uprety
Published: 2024-03-01
Updated: 2026-10-15
Canonical: https://laranepal.com/blog/laravel-how-to-implement-hamropatro-api-for-nepali-date-conversion

# HamroPatro API for Nepali Date Conversion
Hey Laravel enthusiasts! Are you working on a project that requires converting English dates to Nepali dates? Look no further, as I'm here to guide you through implementing the HamroPatro API for seamless Nepali date conversions in your Laravel application.

## Write the Conversion Function
let's add the function `englishDateToNepaliDate()` in your helper.php file. This function will make a POST request to the HamroPatro API to convert English dates to Nepali dates.
```php
use Illuminate\Support\Facades\Http;

if (!function_exists('englishDateToNepaliDate')) {
    function englishDateToNepaliDate()
    {
        $response = Http::asForm()
            ->post('https://www.hamropatro.com/getMethod.php', [
                'actionName' => 'wdconverter',
                'datefield' => date('Y-m-d'),
                'convert_option' => 'eng_to_nep',
            ]);

        if ($response->failed()) {
            return false;
        }

        return $response->body();
    }
}
```
You can now utilize this helper function wherever you need to convert English dates to Nepali dates in your Laravel application. Simply call `englishDateToNepaliDate()` to retrieve the converted date.
```blade
	<li>
		<i class="far fa-clock"></i>
		{!!englishDateToNepaliDate()!!}
	</li>
```
it will look like this:
![](https://laranepal.com/storage/K2gf6zDaCUMdAZoiYIbgddYVuoUjgsksajFmoakJ.png)
That's it! You've successfully implemented the HamroPatro API for Nepali date conversion in your Laravel application. Feel free to customize the helper function further to suit your specific requirements.
