DateBS
A python/javascript library that converts date from BS to AD and vice versa and is intended to be used in google sheet addon, libreoffice calc extension, pandas.
Use Link to heading
Google Sheet AddOn/ LibreOffice Calc Extention Link to heading
The addons expose following custom function so that date from BS to AD and vice versa.
- DateToBS(datestring)
- DateToAD(datestring)
Privacy Policy for Google Sheet Addon Link to heading
The application only contains custom function for your google sheet and does not store any information of the user anywhere.
The application also adheres to the Google API Services User Data Policy, including the Limited Use requirements.
Google OAuth Scope Requested and their purpose Link to heading
- https://www.googleapis.com/auth/spreadsheets :: so that the application can manipulate the spreadsheet it is enabled on.
Google App Script Library Link to heading
ProjectId: M5OVnOjNBAA2Sopb3F1-gozX8b41Gj_r8
Go to Resources > Libraries and add the above library using the above project id.
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 dateapi to convert the date from BS to AD and vice versa.
Examples Link to heading
Get todays 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 opporsite 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())