⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lunar.java

📁 java写的一个万年历程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package millionyear;
//:Lunar.java  处理阴历
import java.util.Calendar;
import java.util.Date;

public class Lunar
{
	
	private final int lunar_calendar_month_table[]={//1901-2100
	0x00,0x04,0xad,0x08,0x5a,0x01,0xd5,0x54,0xb4,0x09,0x64,0x05,0x59,0x45,0x95,0x0a,0xa6,
	0x04,0x55,0x24,0xad,0x08,0x5a,0x62,0xda,0x04,0xb4,0x05,0xb4,0x55,0x52,0x0d,0x94,0x0a,
	0x4a,0x2a,0x56,0x02,0x6d,0x71,0x6d,0x01,0xda,0x02,0xd2,0x52,0xa9,0x05,0x49,0x0d,0x2a,
	0x45,0x2b,0x09,0x56,0x01,0xb5,0x20,0x6d,0x01,0x59,0x69,0xd4,0x0a,0xa8,0x05,0xa9,0x56,
	0xa5,0x04,0x2b,0x09,0x9e,0x38,0xb6,0x08,0xec,0x74,0x6c,0x05,0xd4,0x0a,0xe4,0x6a,0x52,
	0x05,0x95,0x0a,0x5a,0x42,0x5b,0x04,0xb6,0x04,0xb4,0x22,0x6a,0x05,0x52,0x75,0xc9,0x0a,
	0x52,0x05,0x35,0x55,0x4d,0x0a,0x5a,0x02,0x5d,0x31,0xb5,0x02,0x6a,0x8a,0x68,0x05,0xa9,
	0x0a,0x8a,0x6a,0x2a,0x05,0x2d,0x09,0xaa,0x48,0x5a,0x01,0xb5,0x09,0xb0,0x39,0x64,0x05,
	0x25,0x75,0x95,0x0a,0x96,0x04,0x4d,0x54,0xad,0x04,0xda,0x04,0xd4,0x44,0xb4,0x05,0x54,
	0x85,0x52,0x0d,0x92,0x0a,0x56,0x6a,0x56,0x02,0x6d,0x02,0x6a,0x41,0xda,0x02,0xb2,0xa1,
	0xa9,0x05,0x49,0x0d,0x0a,0x6d,0x2a,0x09,0x56,0x01,0xad,0x50,0x6d,0x01,0xd9,0x02,0xd1,
	0x3a,0xa8,0x05,0x29,0x85,0xa5,0x0c,0x2a,0x09,0x96,0x54,0xb6,0x08,0x6c,0x09,0x64,0x45,
	0xd4,0x0a,0xa4,0x05,0x51,0x25,0x95,0x0a,0x2a,0x72,0x5b,0x04,0xb6,0x04,0xac,0x52,0x6a,
	0x05,0xd2,0x0a,0xa2,0x4a,0x4a,0x05,0x55,0x94,0x2d,0x0a,0x5a,0x02,0x75,0x61,0xb5,0x02,
	0x6a,0x03,0x61,0x45,0xa9,0x0a,0x4a,0x05,0x25,0x25,0x2d,0x09,0x9a,0x68,0xda,0x08,0xb4,
	0x09,0xa8,0x59,0x54,0x03,0xa5,0x0a,0x91,0x3a,0x96,0x04,0xad,0xb0,0xad,0x04,0xda,0x04,
	0xf4,0x62,0xb4,0x05,0x54,0x0b,0x44,0x5d,0x52,0x0a,0x95,0x04,0x55,0x22,0x6d,0x02,0x5a,
	0x71,0xda,0x02,0xaa,0x05,0xb2,0x55,0x49,0x0b,0x4a,0x0a,0x2d,0x39,0x36,0x01,0x6d,0x80,
	0x6d,0x01,0xd9,0x02,0xe9,0x6a,0xa8,0x05,0x29,0x0b,0x9a,0x4c,0xaa,0x08,0xb6,0x08,0xb4,
	0x38,0x6c,0x09,0x54,0x75,0xd4,0x0a,0xa4,0x05,0x45,0x55,0x95,0x0a,0x9a,0x04,0x55,0x44,
	0xb5,0x04,0x6a,0x82,0x6a,0x05,0xd2,0x0a,0x92,0x6a,0x4a,0x05,0x55,0x0a,0x2a,0x4a,0x5a,
	0x02,0xb5,0x02,0xb2,0x31,0x69,0x03,0x31,0x73,0xa9,0x0a,0x4a,0x05,0x2d,0x55,0x2d,0x09,
	0x5a,0x01,0xd5,0x48,0xb4,0x09,0x68,0x89,0x54,0x0b,0xa4,0x0a,0xa5,0x6a,0x95,0x04,0xad,
	0x08,0x6a,0x44,0xda,0x04,0x74,0x05,0xb0,0x25,0x54,0x03,};

	private int temp_total_day;
	private int gc_solar_calendar_year;//1-----1901
	private int gc_solar_calendar_month;//实际的阳历月份
	private int gc_solar_calendar_date;
	private int gc_lunar_calendar_year;
	int gc_lunar_calendar_month;
	int gc_lunar_calendar_date;
	private int start_day_of_week;
	
	Lunar(int s_c_year,int s_c_month,int s_c_date)
	{
            this.gc_solar_calendar_year  = s_c_year;
            this.gc_solar_calendar_month = s_c_month;
            if(gc_solar_calendar_year <= 99)//1901-1999
            {
            	switch(s_c_date)
            	{
            		case 1:  this.start_day_of_week =2;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 11;break;
            		case 2:  this.start_day_of_week =3;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 12;break;
            		case 3:  this.start_day_of_week =4;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 13;break;
            		case 4:  this.start_day_of_week =5;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 14;break;
            		case 5:  this.start_day_of_week =6;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 15;break;
            		case 6:  this.start_day_of_week =0;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 16;break;
            		case 7:  this.start_day_of_week =1;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 17;break;
            		case 8:  this.start_day_of_week =2;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 18;break;
            		case 9:  this.start_day_of_week =3;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 19;break;
            		case 10: this.start_day_of_week =4;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 20;break;
            		case 11: this.start_day_of_week =5;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 21;break;
            		case 12: this.start_day_of_week =6;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 22;break;
            		case 13: this.start_day_of_week =0;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 23;break;
            		case 14: this.start_day_of_week =1;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 24;break;
            		case 15: this.start_day_of_week =2;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 25;break;
            		case 16: this.start_day_of_week =3;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 26;break;
            		case 17: this.start_day_of_week =4;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 27;break;
            		case 18: this.start_day_of_week =5;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 28;break;
            		case 19: this.start_day_of_week =6;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 29;break;
            		case 20: this.start_day_of_week =0;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 1;break;
            		case 21: this.start_day_of_week =1;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 2;break;
            		case 22: this.start_day_of_week =2;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 3;break;
            		case 23: this.start_day_of_week =3;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 4;break;
            		case 24: this.start_day_of_week =4;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 5;break;
            		case 25: this.start_day_of_week =5;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 6;break;
            		case 26: this.start_day_of_week =6;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 7;break;
            		case 27: this.start_day_of_week =0;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 8;break;
            		case 28: this.start_day_of_week =1;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 9;break;
            		case 29: this.start_day_of_week =2;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 10;break;
            		case 30: this.start_day_of_week =3;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 11;break;
            		case 31: this.start_day_of_week =4;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 12;break;
            	}
            }
            else
            {
            	switch(s_c_date)
            	{
            		case 1:  this.start_day_of_week =6;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 25;break;
            		case 2:  this.start_day_of_week =0;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 26;break;
            		case 3:  this.start_day_of_week =1;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 27;break;
            		case 4:  this.start_day_of_week =2;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 28;break;
            		case 5:  this.start_day_of_week =3;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 29;break;
            		case 6:  this.start_day_of_week =4;this.gc_lunar_calendar_month = 11;this.gc_lunar_calendar_date = 30;break;
            		case 7:  this.start_day_of_week =5;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 1;break;
            		case 8:  this.start_day_of_week =6;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 2;break;
            		case 9:  this.start_day_of_week =0;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 3;break;
            		case 10: this.start_day_of_week =1;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 4;break;
            		case 11: this.start_day_of_week =2;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 5;break;
            		case 12: this.start_day_of_week =3;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 6;break;
            		case 13: this.start_day_of_week =4;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 7;break;
            		case 14: this.start_day_of_week =5;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 8;break;
            		case 15: this.start_day_of_week =6;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 9;break;
            		case 16: this.start_day_of_week =0;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 10;break;
            		case 17: this.start_day_of_week =1;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 11;break;
            		case 18: this.start_day_of_week =2;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 12;break;
            		case 19: this.start_day_of_week =3;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 13;break;
            		case 20: this.start_day_of_week =4;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 14;break;
            		case 21: this.start_day_of_week =5;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 15;break;
            		case 22: this.start_day_of_week =6;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 16;break;
            		case 23: this.start_day_of_week =0;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 17;break;
            		case 24: this.start_day_of_week =1;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 18;break;
            		case 25: this.start_day_of_week =2;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 19;break;
            		case 26: this.start_day_of_week =3;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 20;break;
            		case 27: this.start_day_of_week =4;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 21;break;
            		case 28: this.start_day_of_week =5;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 22;break;
            		case 29: this.start_day_of_week =6;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 23;break;
            		case 30: this.start_day_of_week =0;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 24;break;
            		case 31: this.start_day_of_week =1;this.gc_lunar_calendar_month = 12;this.gc_lunar_calendar_date = 25;break;
            	}	
            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -