PHP code example of nisshan / nepali-calendar

1. Go to this page and download the library: Download nisshan/nepali-calendar 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/ */

    

nisshan / nepali-calendar example snippets


return [
    'date-format' => 'Y m, d is default format',
    
    'nepali-dates' => 'array of nepali dates'
];

toNepaliDate('2022-1-17'); => '2078 10, 03'

toNepaliDate('2022-1-17', 'Y, m d, D'); => '2078, 10 03, Monday'

toEnglishDate('2078-10-03'); => '2022 1, 17'

toEnglishDate('2078-10-03', 'Y, m d, D'); => '2022, 1 17, Monday'


use Nisshan\NepaliCalendar\DateConversion;

$nepaliDate = DateConversion::convert('2022-1-17')->toNepali();
$nepaliDateWithFormat = DateConversion::convert('2022-1-17','Y, m d, D')->toNepali();


$englishDate = DateConversion::convert('2078-10-03')->toNepali();
$englishWithFormat = DateConversion::convert('2078-10-03','Y, m d, D')->toNepali();



  'Y','y'  => 'Year',
  'M'      => 'Month Name',
  'm'      => 'month'
  'D'      => 'Name of Week Day',
  'd'      => 'date',

bash
php artisan vendor:publish --tag="nepali-calendar-config"