2018-11-09 Pujan Niroula 2 Minute(s) Read

Nepali Date [AD-BS] Converter in PHP

img-open source ad bs.png

If someone says I celebrate my birthday 3 times in a year then he must be lying or he must be Nepalicool. First birthday according to Bikram Sambat date, Second according to After Christ (AD) and third one according to tithi (Lunar Date) system. In this post I will discuss just about two date system and share Free AD-BS Converter in PHP. Because of government and society we must use BS date system and for internet we must use AD date system. Let's make it easy with this wonderful AD/BS converter.

Developing Nepali Date Converter Script

As I mentioned on my first post during daily new idea development period I thought to add multi date system in this So Called CMS. I googled and found desired converter but that has date limitation. If my grandfather want to convert his birthday then it will shows error. So I decided to write my own Nepali date converter in PHP for this blog. You can change date system and language of this blog from Site Setting.

It's completely based on arrays and date system of PHP. I have collected data from different sources. It's little boring to collect the correct data and use those data. I wrote it in very simple way based on counting days between dates. I thought it as most effective idea.

How to Use Nepali Date[ad/bs] Converter on Your Website?

Simply download and upload it to your server. Include it where you want to use. For eg. if you have to display it on index file and include it there and call for action... See my example below. If you want to display time too then use echo $date['l']; (Small L). and you can echo month name or month number by changing Case of $date['m']. Simply I can say you can use pretty same as date() function in PHP, 'm' means month number, 'M' mean month name etc...

How to store time on database for this converter?

It's simple just store time(). This function returns the current time in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

How I Used This PHP Script?

I used it in very simple way. here is my code

$y = date('Y', time()); //Getting Year
$m = date('m', time()); //Getting Month
$d = date('d', time()); //Getting Day
require('nepali-date.php'); //Including library
$date = new nepali_date;
$date = $date->get_nepali_date($y, $m, $d);
echo $date['y'].'-'.$date['m'].'-'.$date['d']; //Printing Date

Lets describe it.
First I got current AD date (Year, Month and day). and called the class and this converter did rest and finally I print all dates.

Wishing Birthday on Nepali[B.S] Dates

If you own sites which is build for Nepali People then you want to wish them on Nepali Date but PHP doesn't support Bikram Sambat date system. Here you can use this to wish them. Store Nepali Date on database and Check today's date with this script. If month and date matched wish them. I have attached full code along with the script.

 Naming This

I almost forgot to name this item.laughing According to vedic astrology a famous astrologer suggested its name - Nepali Date Converter. tongue-out Further he added this name will be beneficial for SEO purpose too. Some astrologers suggested AD/BS date converter but According to market I thought the first one will be great.

Example

You can Check this free Online Nepali Date Converter based on this script.

 Thanks for reading... Glad to see you in comment section below.

Download Attached Files: Nepali Date Converter [Open Source].zip
Comments (130) Add New Comment
Railroad injuries lawyers2024-07-24 10:46 AM

10 Misconceptions That Your Boss May Have Concerning Railroad Injuries Law Railroad injuries lawyers

Reply
personal injury Attorneys2024-07-24 6:48 AM

25 Surprising Facts About Personal Injury Attorney personal injury Attorneys

Reply
fela claims railroad employees2024-07-23 5:45 PM

What's The Job Market For Fela Claims Railroad Employees Professionals Like? fela claims railroad employees

Reply
upvc window2024-07-23 9:58 AM

What's The Current Job Market For Upvc Window Near Me Professionals Like? upvc window

Reply

10 Facebook Pages That Are The Best That I've Ever Seen. ADHD Assessment Private private adhd Assessment worcestershire

Reply
railroad Injuries Lawyer2024-07-23 6:04 AM

How To Make A Profitable Railroad Injuries Settlement When You're Not Business-Savvy railroad Injuries Lawyer

Reply
railroad injuries Attorney2024-07-23 5:26 AM

The Best Railroad Injuries Claim That Gurus Use 3 Things railroad injuries Attorney

Reply
law2024-07-22 5:48 PM

5 Laws Everybody In Personal Injury Compensation Should Know law

Reply
railroad injuries Lawyer2024-07-22 2:00 PM

The Most Profound Problems In Railroad Injuries Litigation railroad injuries Lawyer

Reply
Railroad Injuries Attorney2024-07-22 10:49 AM

10 Tell-Tale Signs You Must See To Know Before You Buy Railroad Injuries Lawyer Railroad Injuries Attorney

Reply
seo Software download2024-07-22 6:22 AM

15 Of The Top SEO Tools And Software Bloggers You Must Follow seo Software download

Reply
patio sliding door Repair2024-07-21 4:19 PM

Patio Sliding Door Repair Tools To Streamline Your Daily Life Patio Sliding Door Repair Trick That Every Person Should Learn patio sliding door Repair

Reply
Latoya2024-07-21 7:30 AM

15 Things You Don't Know About Window Replacement Cambridge upvc door repair cost, Latoya,

Reply
Dorris2024-07-18 8:04 PM

Glazing Doctor Explained In Less Than 140 Characters window condensation repair (Dorris)

Reply
window repairs2024-07-18 2:22 PM

Guide To Double Glazing Window Repairs: The Intermediate Guide On Double Glazing Window Repairs window repairs

Reply
Glass Doctor2024-07-18 1:46 PM

What's The Reason Nobody Is Interested In The Window Doctors Glass Doctor

Reply
patio door Repair company2024-07-17 4:39 PM

Patio Door Repair Service Near Me: What Nobody Is Talking About patio door Repair company

Reply
articlescad.com2024-07-17 1:59 PM

10 Real Reasons People Dislike Upvc Window Repairs Upvc Window Repairs upvc Window repairs near me, articlescad.com,

Reply
Broken2024-07-17 11:20 AM

Looking For Inspiration? Look Up Window Repair Near Broken

Reply
Tanesha2024-07-16 3:46 PM

Ten Things You Learned About Kindergarden They'll Help You Understand Repairs To Upvc Windows upvc window repair - Tanesha,

Reply
window Repairs Luton2024-07-16 8:12 AM

What's The Current Job Market For Window Repairs Luton Professionals? window Repairs Luton

Reply
Top2024-07-16 6:16 AM

The Top Reasons People Succeed Within The Best SEO Company London Industry Top

Reply
git.mintmuse.com2024-07-15 8:39 PM

15 Things You've Never Known About Top Slots slot Offers, git.mintmuse.com,

Reply
Telegra.Ph2024-07-15 4:00 PM

The 9 Things Your Parents Teach You About Double Glazing Doctor Near Me Double Glazing Doctor (Telegra.Ph)

Reply
progressive slots2024-07-15 1:33 PM

The 10 Most Scariest Things About Progressive Slots progressive slots

Reply
milton Keynes Locksmith2024-07-15 10:55 AM

The 10 Scariest Things About Door Fitters Milton Keynes milton Keynes Locksmith

Reply
Tempaste.com2024-07-15 4:43 AM

7 Tips About Window Repair Near That Nobody Can Tell You upvc window Repair near me; Tempaste.com,

Reply
window Refurbishment2024-07-15 4:15 AM

5 The Door Doctor Near Me Lessons Learned From Professionals window Refurbishment

Reply
glass specialists near me2024-07-13 9:04 PM

Say "Yes" To These 5 Windows And Doors Luton Tips glass specialists near me

Reply
door Repairs london2024-07-13 7:30 PM

Upvc Door Repairs London Tools To Help You Manage Your Daily Life Upvc Door Repairs London Trick Every Individual Should Know door Repairs london

Reply

You really make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!

Reply
uk Porn Star2024-07-13 4:16 AM

How To Tell If You're In The Right Place To Go After Pornstar UK uk Porn Star

Reply
media.rbl.ms2024-07-11 7:39 PM

Seo Checklist - Ways To Do It Right Your First Time ?????? (media.rbl.ms)

Reply
Railroad Injuries Lawyer2024-07-11 12:21 PM

Nine Things That Your Parent Taught You About Railroad Injuries Lawyer Railroad Injuries Lawyer

Reply
Anita2024-07-08 2:45 AM

5 The 5 Reasons Glazing Specialists London Is A Good Thing home window repair london (Anita)

Reply
south florida weather2024-07-07 10:47 AM

Wonderful, what a blog it is! This web site presents useful facts to us, keep it up.

Reply
toolbarqueries.google.bi2024-07-06 11:12 AM

How To Build Successful Double Glazing Windows High Wycombe How-tos And Tutorials To Create Successful Double Glazing Windows High Wycombe Home glass cut to size high wycombe (toolbarqueries.google.bi)

Reply

The Reasons You'll Want To Find Out More About Aluminium Patio Door Repairs how to Repair tilt and slide patio door

Reply
shopping Online uk websites2024-07-05 12:44 AM

7 Easy Tips For Totally Refreshing Your Uk Online Shopping Sites Like Amazon shopping Online uk websites

Reply
Replacement Glass For Windows2024-07-04 5:35 AM

The 10 Most Terrifying Things About Replacement Glass For Windows Replacement Glass For Windows

Reply
near by2024-07-04 2:50 AM

10 Places That You Can Find Window And Door Company Near Me near by

Reply
Double Glazed window Repairs2024-07-02 11:43 PM

What's The Current Job Market For Double Glazed Window Repairs Professionals Like? Double Glazed window Repairs

Reply
Marcelino2024-07-02 11:31 PM

How To Save Money On Zeus 1000 Slot zeus 111 slot machine free (Marcelino)

Reply
Hyundai veloster key fob2024-07-02 1:38 AM

The Most Successful Hyundai Car Key Replacement Cost Gurus Are Doing 3 Things Hyundai veloster key fob

Reply

The Top Reasons For Windows Repair's Biggest "Myths" About Windows Repair Could Be True double Glazed window repairs near me

Reply
Sofas sectional2024-07-01 2:44 PM

What's The Job Market For Sofas Sectionals Professionals Like? Sofas sectional

Reply
wooden windows double glazed2024-07-01 9:53 AM

Who Is Double Glaze Repair Near Me And Why You Should Consider Double Glaze Repair Near Me wooden windows double glazed

Reply
double Glazing near me2024-06-30 10:01 PM

Guide To Double Glazing Near Me: The Intermediate Guide In Double Glazing Near Me double Glazing near me

Reply
double glazed repairs near me2024-06-30 3:43 PM

What's The Current Job Market For Double Glazed Repairs Near Me Professionals Like? double glazed repairs near me

Reply
window repairs2024-06-30 9:06 AM

5 Laws That Anyone Working In Repair A Window Should Know window repairs

Reply
Lauri2024-06-29 2:04 PM

Ten Coffee To Bean Machines That Really Help You Live Better coffee to bean machines (Lauri)

Reply
Case Opening2024-06-29 1:40 PM

What's Holding Back In The CSGO Case Battle Industry? Case Opening

Reply
Vimeo.com2024-06-29 12:35 PM

10 Steps To Begin Your Own Online Shopping Websites List Business Rubbermaid (Vimeo.com)

Reply
Tracey2024-06-29 10:52 AM

One Of The Biggest Mistakes That People Make With Birmingham Windows And Doors aluminium windows birmingham (Tracey)

Reply
Online shopping websites list2024-06-29 9:12 AM

You'll Never Guess This Online Shopping Websites List's Tricks Online shopping websites list

Reply
Slot Machines2024-06-29 1:42 AM

The Advanced Guide To Slot Innovations Slot Machines

Reply
good online shopping Sites uk2024-06-28 1:27 PM

The 10 Most Terrifying Things About Good Online Shopping Sites Uk good online shopping Sites uk

Reply
circuit tester multimeter2024-06-28 7:23 AM

Where Do You Think Amazon Online Shopping Clothes Uk 1 Year From What Is Happening Now? circuit tester multimeter

Reply

The 10 Scariest Things About Private ADHD Assessment Liverpool Cost private adhd assessment liverpool cost

Reply
Car Racing Safety Suit2024-06-27 9:56 AM

Are The Advances In Technology Making Cheap Online Electronics Shopping Uk Better Or Worse? Car Racing Safety Suit

Reply
window repair Near me2024-06-27 9:17 AM

You'll Never Guess This Window Repair Near's Secrets window repair Near me

Reply
Electronic Muscle Stimulation2024-06-27 6:49 AM

10 Websites To Help You Learn To Be An Expert In Shopping Online Electronic Muscle Stimulation

Reply

The 10 Most Terrifying Things About Online Grocery Stores That Ship online Grocery Stores That ship

Reply
vimeo.Com2024-06-26 11:01 PM

The Most Negative Advice We've Ever Heard About Shopping Online Sites Office Trash Can; vimeo.Com,

Reply
seat leon key Replacement2024-06-26 5:02 PM

Seat Leon Key Replacement Tools To Help You Manage Your Daily Life Seat Leon Key Replacement Trick That Everyone Should Know seat leon key Replacement

Reply
cheap online Shopping sites Uk2024-06-26 4:29 PM

9 Things Your Parents Teach You About Cheap Online Shopping Sites Uk cheap online Shopping sites Uk

Reply
Francis2024-06-26 3:43 PM

5 Killer Quora Answers To Free Casino Slots free casino slots - Francis -

Reply
urban metal Counter stools2024-06-26 3:14 PM

7 Tips About Online Shopping Uk That No One Will Tell You urban metal Counter stools

Reply

The 10 Most Terrifying Things About Waitrose Groceries Online Shopping Uk Waitrose Groceries Online Shopping Uk

Reply
bookmarkzones.trade2024-06-26 6:51 AM

A Look At The Myths And Facts Behind Slot Walk-Throughs top-rated online slots - bookmarkzones.trade,

Reply
upvc Door Repairs near Me2024-06-26 6:06 AM

You'll Never Guess This Upvc Door Repairs Near Me's Tricks upvc Door Repairs near Me

Reply
Vimeo2024-06-25 11:48 PM

Who's The Top Expert In The World On London Online Mobile Shopping Sites? Vimeo

Reply
Eva2024-06-25 8:25 PM

What's The Current Job Market For Online Shopping Uk For Clothes Professionals Like? online shopping uk for clothes (Eva)

Reply

You'll Never Be Able To Figure Out This Online Clothes Shopping Websites Uk's Benefits online clothes shopping websites uk

Reply
leak-proof brew kettle valve2024-06-25 2:31 PM

10 Things You've Learned About Preschool That Will Help You With Online Shopping Uk For Clothes leak-proof brew kettle valve

Reply
New Classic Antique Nightstand2024-06-25 8:46 AM

Responsible For A Online Sites For Shopping In Uk Budget? 12 Top Ways To Spend Your Money New Classic Antique Nightstand

Reply

9 Things Your Parents Teach You About Content Marketing On Social Media Content Marketing On Social Media

Reply
you can try here2024-06-24 10:55 PM

Hi, I think your site might be having browser compatibility issues. When I look at your blog site in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, wonderful blog!

Reply
Hollywood Theme Party Favors2024-06-21 5:56 AM

10 Things You Learned From Kindergarden To Help You Get Started With Online Shopping Clothes Uk Cheap Hollywood Theme Party Favors

Reply
Kingcamp Camping Gear Table2024-06-17 1:20 PM

9 Things Your Parents Teach You About Best Online Shopping Sites London Kingcamp Camping Gear Table

Reply
Slot Promotions2024-06-16 3:18 AM

The 10 Most Scariest Things About Slot Promotions Slot Promotions

Reply
Thick Bully Pizzle2024-06-16 1:18 AM

The Most Successful Top 10 Online Shopping Sites In Uk For Clothes Experts Have Been Doing 3 Things Thick Bully Pizzle

Reply
upvc window repair near Me2024-06-15 5:26 PM

It's Time To Expand Your Replacement Upvc Window Handles Options upvc window repair near Me

Reply
Ghost immobiliser problems2024-06-14 3:28 AM

See What Ghost Immobiliser Problems Tricks The Celebs Are Using Ghost immobiliser problems

Reply
rendingnicheblog.top2024-06-14 2:03 AM

Here Is The You Can Move Web Site To Ones Domain (Part 2) rendingnicheblog (rendingnicheblog.top)

Reply
Rack Mount Shelf Slides2024-06-13 10:46 PM

Five People You Need To Know In The List Of Online Shopping Sites In Uk Industry Rack Mount Shelf Slides

Reply
Peakpulsesite.Top2024-06-13 3:37 AM

Powerful Blog Seo Assist In Improve Your Google Ranking Peakpulsesite (Peakpulsesite.Top)

Reply
Bravo Case2024-06-12 5:57 PM

11 Methods To Redesign Completely Your CSGO Cases Highest Roi Bravo Case

Reply
dashdome2024-06-12 2:07 PM

How Turn Into An Expert Blog Writer dashdome

Reply
aqueon shrimp Care2024-06-12 11:04 AM

What Is The Reason? Amazon Uk Online Shopping Clothes Is Fast Increasing To Be The Hottest Trend Of 2023? aqueon shrimp Care

Reply
slotcoin2024-06-12 5:41 AM

You Wrote A New Blog Post, Now What Normally? slotcoin

Reply
window replacement near me2024-06-12 3:35 AM

The Top 5 Reasons Why People Are Successful In The Double Glazed Window Repair Industry window replacement near me

Reply
Rentry.Co2024-06-11 11:53 PM

5 Killer Quora Answers On How Much Are Spare Car Keys How Much Are Spare Car Keys (Rentry.Co)

Reply
Prisma case2024-06-11 8:36 PM

11 Ways To Completely Redesign Your CSGO Cases To Invest In Prisma case

Reply
Georgia2024-06-11 1:42 PM

You'll Never Be Able To Figure Out This Avon Skin So Soft Oil's Secrets avon skin so soft oil (Georgia)

Reply
Best Online Clothing Sites Uk2024-06-11 11:11 AM

The 9 Things Your Parents Taught You About Best Online Clothing Sites Uk Best Online Clothing Sites Uk

Reply
blogpulse.Top2024-06-11 6:08 AM

Blog Optimization Tips blogpulse, blogpulse.Top,

Reply
online shopping uk discount2024-06-11 3:09 AM

Guide To Online Shopping Uk Discount: The Intermediate Guide The Steps To Online Shopping Uk Discount online shopping uk discount

Reply
second hand double buggy2024-06-10 10:14 PM

See What Second Hand Double Buggy Tricks The Celebs Are Utilizing second hand double buggy

Reply
Blog2024-06-09 11:20 PM

Work In A Home Office Tips - Blogging For Online Income Blog

Reply
coinsslot.Com2024-06-09 10:24 PM

What's A Blog? Why Should I Get Blogging Services? coinsslot (coinsslot.Com)

Reply
Vimeo.Com2024-06-09 6:11 PM

11 Ways To Destroy Your Amazon Online Shopping Clothes Uk Durable Kitchen Cutting Board [Vimeo.Com]

Reply
escape rooms list2024-06-09 5:48 PM

Hi there! Do you know if they make any plugins to assist with Search Engine Optimization? I'm trying to get my site to rank for some targeted keywords but I'm not seeing very good results. If you know of any please share. Cheers! I saw similar art here: Escape room

Reply
Nexusnook.top2024-06-09 4:13 PM

How Generate A List With Your Blog - Easy Tips To Acquire Started nexusnook (Nexusnook.top)

Reply
Welcome Kit2024-06-09 4:21 AM

Five Killer Quora Answers To Welcome Kits Welcome Kit

Reply
Umesh Gaire2024-06-03 5:16 AM

Please help me to generate nepali date like this: 2081-02-21 in AD we can do with date('Y-m-d'); I hope you understood what I am expecting.

Reply
Ramesh2023-08-21 11:25 AM

Invalid Year range, when selected day 32 of the month

Reply
Laxman Adhikari2023-04-10 2:57 PM

hello i what to know how array of months is calculated .

Reply
Njn Khanal2022-11-19 7:51 AM

At first thank you so much for this, everything working well but when converting to nepali date month end like kartik 31 its showing mansir 1

Reply
Muniraj Rajbanshi2021-05-13 7:56 AM

How to get two digit year ?

Reply
Pujan Niroula2021-05-30 6:07 PM

No option, you can trim first two digit :) get your hands dirty

Sujan Stc2021-04-14 2:29 PM

If you are facing problem tallying nepali date and english date with 'Asia/Kathmandu' timezone, use timezone_open('UTC') on every date_create function like so: $date_start=date_create($this->firstday_en,timezone_open('UTC')); This will perfectly tally with english time and you dont have to change to UTC if your site is already using 'Asia/Kathmandu' timezone.

Reply
Pujan Niroula2021-05-30 6:08 PM

Thanks :)

Gopal Nepal2020-09-18 11:05 AM

Hello sir, I want to display format like this २०७७ असोज २ . But, find format for month not for year and day. How to do that ?

Reply
Pujan Niroula2020-09-29 2:59 AM

You can convert output date to devanagari Numbers with this function <?php function devanagari($num) { $num_nepali = array('०','१','२','३','४','५','६','७','८','९'); $num_eng = array('0','1','2','3','4','5','6','7','8','9'); $nums = str_replace($num_eng, $num_nepali, $num); return $nums; } echo devanagari('13905'); //Output १३९०५ ?>

John Doe2020-06-28 3:46 AM

Does anybody has ad-bs converter in javascript

Reply
Hiramani Pun2020-06-03 10:20 AM

today is 2020/06/03 and in nepali 2077/02/21, its showing nepali date 2077/2/20 , what's the problem ?

Reply
Sujan Stc2021-04-14 2:31 PM

Simple solution is above at my comment. Please check.

Pujan Niroula2020-06-03 1:06 PM

Set timezones to UTC. Place date_default_timezone_set('UTC'); before require("nepali-date.php");

Ankit Subedi2020-01-16 5:06 AM

First of all, thank you so much for the converter. But, I have a problem. The code works perfectly fine on localhost, but shows "Fatal error: Uncaught Error: Call to undefined function cal_days_in_month()" this error when deployed. Is there anything i am missing?

Reply
Pujan Niroula2020-01-17 4:54 PM

Sorry! I can't do anything for that. Looks like server side problem. :(

Yogendra2019-12-05 5:49 PM

I have been trying to use your code but it is returning the non numeric error and couldnot use it.could you please help out

Reply
Pujan Niroula2019-12-10 9:06 AM

I have updated the code. Please check, thanks :)

InNepall2019-11-06 4:14 AM

Can you please update the code. I am getting an error with PHP 7.3 "Warning: A non-numeric value encountered in ../nepali-date.php on line 190" Thank you for sharing your hard work.

Reply
Pujan Niroula2019-12-10 9:11 AM

I have updated the code, Please check thanks for your patience. :) Anyway there was little problem on 186 line. Compare to find out more :-D

Binod Stha2018-11-13 5:22 AM

Hi, Thanks for sharing. Please share your nepali date converter's full code also.

Reply
Baha2019-09-10 4:03 AM

https://github.com/bahadurbaniya/Date-Converter-Bikram-Sambat-to-English-Date full code in Java here.

Pujan Niroula2018-12-13 8:44 AM

Sorry for late reply... Currently we don't have plan to share these scripts, In future we will... Hope you understand...