DateBS
A Python™/JavaScript™ library that converts dates from Bikram Sambat (BS) to Anno Domini (AD) and vice versa, intended for use in Google Sheets™ add-ons, LibreOffice™ Calc extensions, and Pandas™.
Use Link to heading
Google Sheets™ Add-on / LibreOffice™ Calc Extension Link to heading
The add-on exposes the following custom functions to convert dates from BS to AD and vice versa:
DateToBS(datestring)DateToAD(datestring)
Privacy Policy for Google Sheets™ Add-on Link to heading
The application only contains custom functions for your Google Sheets™ spreadsheets and does not store or share any user information anywhere.
The application also adheres to the Google™ API Services User Data Policy, including the Limited Use requirements.
Google™ OAuth Scope Requested and Purpose Link to heading
https://www.googleapis.com/auth/spreadsheets:: Enables the application to manipulate the Google Sheets™ spreadsheet on which it is enabled.
Google Apps Script™ Library Link to heading
ProjectId: M5OVnOjNBAA2Sopb3F1-gozX8b41Gj_r8
Go to Resources > Libraries and add the library using the project ID above.
npm Module Link to heading
npm install datebs
date = require('datebs');
let today = DateBS.fromAD();
console.log(today);
console.log(today.toAD());
Deno Module Link to heading
deno install deno.land/x/datebs/index.ts
import { DateBS } from "https://raw.githubusercontent.com/shubhajeet/DateBS/master/src/index.ts";
let today = DateBS.fromAD();
console.log(today);
console.log(today.toAD());
Web App Link to heading
You can use our Date API to convert dates from BS to AD and vice versa.
Examples Link to heading
Get today’s date in BS Link to heading
curl -L https://bit.ly/dateapi
Convert date from BS to AD Link to heading
curl -L https://bit.ly/dateapi?dateBS=2077-03-01
Convert date from AD to BS Link to heading
curl -L https://bit.ly/dateapi?dateAD=2020-01-03
Python™ Link to heading
pip install datebs
Example Code Link to heading
from datebs import DateBS
import argparse
import datetime
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="python -m datebs", description='Convert date from BS to AD and vice-versa')
parser.add_argument('calendar', type=str, help="calendar system in which date is to be displayed [AD|BS]")
parser.add_argument('--date', type=str, help="date opposite to the calendar system")
args = parser.parse_args()
if (args.calendar == "BS"):
if args.date:
dateBS = DateBS.from_AD(datetime.datetime.strptime(args.date, "%Y-%m-%d"))
else:
dateBS = DateBS.from_AD(datetime.datetime.now())
print(dateBS)
else:
if args.date:
dateBS = DateBS.from_string(args.date)
print(dateBS.to_AD())
else:
print(datetime.datetime.now())
Google™, Google Sheets™, Google Apps Script™, Google Workspace™, and Google Workspace Marketplace™ are trademarks of Google LLC.