Open source Multi-language Gregorian lunar calendar conversion

Source: Internet
Author: User

Lunar Solar Calendar Converter

Gregorian (solar) lunar (lunar) conversion, support period from 1900-2100
If a longer period of time is required, the data generated by generate.htm can be used.
Supports various programming languages C#,java,objective-c,php,python,javascript (Nodejs), C/c++,ruby,swift, etc.
Support MAC,WINDOWS,ANDROID,WP Multiple Platforms

Data validation
1.用io.js(nodejs)写了一个httpserver,各种语言可以通过下面的http接口验证不同实现的数据一致性。在javascript目录下node check.js启动2.http://localhost:1337/?src=2015,1,15 (公历转农历,返回2014,11,25,0) 或者   http://localhost:1337/?src=2014,11,25,0 (农历转公历,返回2015,1,15)3.比如在C#版本中,Check.cs 实现了C#与nodejs的数据比对
Basic principle
    • Tabular There are 2 data sheets, for each year, a table with the first day of the first month of the lunar calendar, and the other table with the X-year of the lunar calendar of days and months of the leap months. The dates are then offset according to the two tables.
    • All the data passed the comparison of Microsoft Chineselunisolarcalendar class. The comparison program is in the C # version.
API for CSharp or Java
/***农历转公历*/public static Solar LunarToSolar(Lunar lunar)/***公历转农历*/public static Lunar SolarToLunar(Solar solar)
API for Objective-c
/***农历转公历*/+ (Solar *)lunarToSolar:(Lunar *)lunar;/***公历转农历*/+ (Lunar *)solarToLunar:(Solar *)solar;
API for PHP
/***农历转公历*/public static function LunarToSolar($lunar)/***公历转农历*/public static function SolarToLunar($solar)
API for Python
/***农历转公历*/def LunarToSolar(self, lunar):/***公历转农历*/def SolarToLunar(self, solar):
API for JavaScript
/***农历转公历*/this.LunarToSolar = function (lunar)/***公历转农历*/this.SolarToLunar = function (solar)
API for C + +
/***农历转公历*/Solar LunarToSolar(Lunar lunar);/***公历转农历*/Lunar SolarToLunar(Solar solar);
API for Ruby
/***农历转公历*/def LunarToSolar(lunar)/***公历转农历*/def SolarToLunar(solar)
API for Swift
/***农历转公历*/class func LunarToSolar( lunar:Lunar)->Solar/***公历转农历*/class func SolarToLunar( solar:Solar)->Lunar

Open source Multi-language Gregorian lunar calendar conversion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.