PHP code example of sghimire / nepali-date-library
1. Go to this page and download the library: Download sghimire/nepali-date-library 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/ */
sghimire / nepali-date-library example snippets
epaliDateLibrary\NepaliDate;
use function NepaliDateLibrary\ADtoBS;
use function NepaliDateLibrary\BStoAD;
$now = new NepaliDate();
echo $now->format('YYYY-MM-DD'), PHP_EOL;
// Parse a Nepali date string
$d = new NepaliDate('2080-01-15');
echo $d->format('DDDD, MMMM D, YYYY'), PHP_EOL; // Friday, Baisakh 15, 2080
// Convert between AD and BS
echo ADtoBS('2023-04-14'), PHP_EOL; // 2080-01-01
echo BStoAD('2080-01-01'), PHP_EOL; // 2023-04-14
// Arithmetic and comparisons
$next = $d->addMonths(1);
echo $d->isBefore($next) ? 'before' : 'after', PHP_EOL;
// Fiscal years and quarters
$quarter = NepaliDate::getQuarter(1, 2080);
echo $quarter['start']->format('YYYY-MM-DD'), ' - ', $quarter['end']->format('YYYY-MM-DD'), PHP_EOL;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.