Date Converter - AD to BS and BS to AD

Date Converter - AD to BS and BS to AD

Here in this post, we are going to learn to use a very useful PHP library for date Conversions. You can download the library from http://adf.ly/PXdXQ . The file contains the library file nepali_calendar.php and an example file 'example.php' zipped in.

This library can be used for conversion of dates in AD to BS and vice-verse. Besides date conversion there are a few helper functions too like checking leap year, getting name of the month, getting day of the week and so on.

However, the library has limitations. The limitation is on the range of date that can be converted. For AD to BS conversion the range is 1944 to 2022 and for BS to AD it is 2000 to 2089. You can also extend this library for yourself.

A simple usage of the library is:
<?php
include 'nepali_calendar.php';
$cal=new Nepali_Calendar();
print_r($cal->eng_to_nep('2013','09','04')); //for ad to bs conversion
print_r($cal->nep_to_eng('2070,'02','10'));// for bs to ad conversion
?>

Comments

Popular posts from this blog

Automate file upload in Selenium IDE

How To Install and Configure Nextcloud