Converting to and from Hindu calendar Converting to and from Hindu calendar python python

Converting to and from Hindu calendar


Did you check DateTime-Indic-0.1 family of modules? At least DateTime::Indic::Chandramana seems to have a method to convert traditional date into UTC values (utc_rd_values).

UPDATE:

I suppose Calendar::Saka may be useful as well for many users (as I have known, it's the Indian national calendar), in particular, to_gregorian() and from_gregorian() methods.


For Python, use calendar2 (note: this is not the built-in calendar module).

Sample use:

>>> from calendar2 import *>>> old_hindu_solar_from_absolute(absolute_from_gregorian(3,1,2012))(11, 16, 5112)>>> old_hindu_lunar_from_absolute(absolute_from_gregorian(3,1,2012))(12, 0, 8, 5112)


Paper: Indian Calendrical Calculations
Provides Common Lisp code in the appendix.

While a Python (or other language) solution could be written according to the paper, the authors enumerate the Indian calendar rules pretty well, so it's a pretty solid paper if you're willing to consider taking the provided Common Lisp code.