Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting to and from Hindu calendar

How can I convert unix time to Hindu calendar­Wikipedia time and the other way round in php, Perl or Python or Java? I know I can convert to Hebrew and Jewish. But Hindu is not an option.

To be more specific, I'm talking about the Hindu lunar calendar. The following website is working and does exactly what I want: http://web.meson.org/calendars/. For example, it 'translates' 28-1-2012 (Gregorian) to 5-11-2068 (Hind. Lun.). How can I accomplish the same task? And if there are absolutely no scrips out there, how can I write it myself?

like image 556
www.data-blogger.com Avatar asked Dec 27 '11 14:12

www.data-blogger.com


People also ask

What is difference between Hindu calendar and normal calendar?

Unlike the Gregorian calendar which adds additional days to the month to adjust for the mismatch between twelve lunar cycles (354 lunar days) and nearly 365 solar days, the Hindu calendar maintains the integrity of the lunar month, but inserts an extra full month by complex rules, once every 32–33 months, to ensure ...

How is the Hindu calendar calculated?

It is based on a year of 12 lunar months; i.e., 12 full cycles of phases of the Moon. The discrepancy between the lunar year of about 354 days and the solar year of about 365 days is partially resolved by intercalation of an extra month every 30 months.

How do you convert Gregorian calendar to Saka?

Since year 1 of the Indian calendar differs from year 1 of the Gregorian, to determine whether a year in the Indian calendar is a leap year, add 78 to the year of the Saka era then apply the Gregorian calendar rule to the sum.


1 Answers

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.

like image 73
raina77ow Avatar answered Sep 17 '22 18:09

raina77ow