PHP code example of kmlpandey77 / ndate

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

    

kmlpandey77 / ndate example snippets


use Kmlpandey77\Ndate\Ndate;

# Example 01

$date_to_bs = Ndate::to_bs("2023-11-08");

echo $date_to_bs // OUTPUT: 2080-07-22 
echo $date_to_bs->lang(Ndate::NP) // OUTPUT: २०८०-०७-२२


# Example 02

$date_to_bs = Ndate::to_bs("2023-11-08", 'd/m/Y');

echo $date_to_bs // OUTPUT: 22/07/2080
echo $date_to_bs->format('l, d M, Y') // Wednesday, 22 Kartik, 2080
echo $date_to_bs->format('l, d M, Y')->lang(Ndate::NP) // OUTPUT: बुधवार, २२ कार्तिक, २०८०

use Kmlpandey77\Ndate\Ndate;

# Example 01

$date_to_ad = Ndate::to_ad("2080-07-22");

echo $date_to_ad // OUTPUT: 2023-11-08

# Example 02
$date_to_ad = Ndate::to_ad("2080-07-22", 'd/m/Y');

echo $date_to_ad // OUTPUT: 08/11/2023