使用说明: 主方法为RiliLunarClass4jyecyea.getSoralTerm();

如: Alert.show(RiliLunarClass4jyecyea.getSoralTerm(2011,3,21)); 则可得到 2011-3-21的节气为"春分"..如果当日不是节气,返回空字符串

调用范例: 循环2011年的所有节气function addJyecyea(ac:ArrayCollection):void{for(var i=1;i<=12;i++){for(var j=1;j<=31;j++){var jc:String= RiliLunarClass4jyecyea.getSoralTerm(2011,i,j);if(jc!=""){//DOING SOMETHING...}}}}----------------------------------源码----------

package{public class RiliLunarClass4jyecyea{public function RiliLunarClass4jyecyea(){}public static var solarTerm:Array = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至");private static var sTermInfo:Array = new Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758);//===== 某年的第n个节气为几日(从0小寒起算)private static function sTerm(y:int, n:int):int{var offDate:Date = new Date((31556925974.7 * (y - 1900) + sTermInfo[n] * 60000) + Date.UTC(1900, 0, 6, 2, 5));return (offDate.getUTCDate());}/** 核心方法 根据日期(y年m月d日)得到节气 */public static function getSoralTerm( y:int, m:int , d:int):String {var solarTerms:String;if (d == sTerm(y, (m - 1) * 2))solarTerms = solarTerm[(m - 1) * 2];else if (d == sTerm(y, (m - 1) * 2 + 1))solarTerms = solarTerm[(m - 1) * 2 + 1];else {// 到这里说明非节气时间solarTerms = "";}return solarTerms;}}}

Powered by