赞
踩
农历几月几日星期几了,其他的话用的比较少,所以这个类很有帮助的
/**
* ChineseDateUtil .java
* Copyright(c)1997-2002byDr.HerongYang.http://www.herongyang.com/
* 中国农历算法-实用于公历1901年至2100年之间的200年
*/
public class ChineseDateUtil {
private int gregorianYear;
private int gregorianMonth;
private int gregorianDate;
private boolean isGregorianLeap;
private int dayOfYear;
private int dayOfWeek;// 周日一星期的第一天
private int chineseYear;
private int chineseMonth;// 负数表示闰月
private int chineseDate;
private int sectionalTerm;
private int principleTerm;
public static void main(String[] arg) {
ChineseDateUtil c = new ChineseDateUtil();
String cmd = "day";
int y = 2010;
int m = 5;
int d = 20;
c.setGregorian(y, m, d);
c.computeChineseFields();
c.computeSolarTerms();
System.out.println(c.getChineseYear());
System.out.println(c.getChineseMonth());
System.out.println(c.chineseDate);
System.out.println(c.principleTerm);
System.out.println(c.sectionalTerm);
System.out.println(c.getSectionalTermName());
System.out.println(c.getPincipleTermName());
System.out.println(c.getChineseDate());
}
}
posted on 2012-08-08 17:03 墙头草 阅读(476) 评论(0) 编辑 收藏
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。