PHP code example of surazdott / nepali-date

1. Go to this page and download the library: Download surazdott/nepali-date library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

surazdott / nepali-date example snippets


use Carbon\Carbon;
use NepaliDate\Facades\NepaliDate;

NepaliDate::create(Carbon::now())->toBS(); // 2080-12-20
NepaliDate::create(Carbon::now())->toFormattedBSDate(); // 21 Chaitra 2080, Wednesday
NepaliDate::create(Carbon::now())->toFormattedNepaliDate(); // २१ चैत २०८०, बुधवार

$user->created_at->toBS(); // 2080-12-20
$user->created_at->toFormattedNepaliDate(); // २१ चैत २०८०, बुधवार

NepaliDate::create(Carbon::now())->toNepaliFormat('Y-m-d'); // २०८०-१२-२१
NepaliDate::create(Carbon::now())->toBSformat('d F Y'); // 21 Chaitra 2080