阴历与阳历的对照

转载 2004年07月08日 03:28:00

很多人希望找到自己阴历对应的阳历是多少,对于这个非常简单的问题,万年历对于不经常上网的朋友竟然也是很困难,我决心解决这个问题。

下面我写了个Java小程序,利用了网上一些现有的资源,大家可以直接输入自己的阴历或者阳历生日,点“提交”就可以看到转变后的日期了。希望对大家有用。

http://three.freejsp.net/yuanqingfei/

 

感谢http://www.freejsp.net/?id=yuanqingfei提供空间支持

发信人: hjdwg (小鱼儿), 信区: MathTools        标  题: Re: 谁有阴历与阳历的对照 发信站: BBS 水木清华站 (Sat May 31 21:20:25 2003), 转信 巧了,我曾用matlab做了一个,现在贴上来。 function xx = LunarCalendar(y,m,d) %  function xx = LunarCalendar(y,m,d) %   %  农历查询,改编自某网页之JavaScript,欢迎改动 % %  Author:  hjdwg@0451.com if nargin==0;     cccc=clock;     y=cccc(1);m=cccc(2);d=cccc(3); end Animals={'鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪'}; solarTerm ={'小寒','大寒','立春','雨水','惊蛰','春分', ...         '清明','谷雨','立夏','小满','芒种','夏至', ...         '小暑','大暑','立秋','处暑','白露','秋分', ...         '寒露','霜降','立冬','小雪','大雪','冬至'}; CnDayStr={'初一', '初二', '初三', '初四', '初五', ...         '初六', '初七', '初八', '初九', '初十', ...         '十一', '十二', '十三', '十四', '十五', ...         '十六', '十七', '十八', '十九', '二十', ...         '廿一', '廿二', '廿三', '廿四', '廿五', ...         '廿六', '廿七', '廿八', '廿九', '三十'}; CnMonthStr= { '正', '二', '三', '四', '五', '六', '七', '八', '九', '十', '冬', '腊'}; monthName = {'JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'}; lunarInfo=[19416,19168,42352,21717,53856,55632,91476,22176,39632,21970, ...         19168,42422,42192,53840,119381,46400,54944,44450,38320,84343, ...         18800,42160,46261,27216,27968,109396,11104,38256,21234,18800, ...         25958,54432,59984,28309,23248,11104,100067,37600,116951,51536, ...         54432,120998,46416,22176,107956,9680,37584,53938,43344,46423, ...         27808,46416,86869,19872,42448,83315,21200,43432,59728,27296, ...         44710,43856,19296,43748,42352,21088,62051,55632,23383,22176, ...         38608,19925,19152,42192,54484,53840,54616,46400,46496,103846, ...         38320,18864,43380,42160,45690,27216,27968,44870,43872,38256, ...         19189,18800,25776,29859,59984,27480,21952,43872,38613,37600, ...         51552,55636,54432,55888,30034,22176,43959,9680,37584,51893, ...         43344,46240,47780,44368,21977,19360,42416,86390,21168,43312, ...         31060,27296,44368,23378,19296,42726,42208,53856,60005,54576, ...         23200,30371,38608,19415,19152,42192,118966,53840,54560,56645, ...         46496,22224,21938,18864,42359,42160,43600,111189,27936,44448]; lYearDays=[384,354,355,383,354,355,384,354,355,384, ...         354,384,354,354,384,354,355,384,355,384, ...         354,354,384,354,354,385,354,355,384,354, ...         383,354,355,384,355,354,384,354,384,354, ...         354,384,355,354,385,354,354,384,354,384, ...         354,355,384,354,355,384,354,383,355,354, ...         384,355,354,384,355,353,384,355,384,354, ...         355,384,354,354,384,354,384,354,355,384, ...         355,354,384,354,384,354,354,384,355,355, ...         384,354,354,383,355,384,354,355,384,354, ...         354,384,354,355,384,354,385,354,354,384, ...         354,354,384,355,384,354,355,384,354,354, ...         384,354,355,384,354,384,354,354,384,355, ...         354,384,355,384,354,354,384,354,354,384, ...         355,355,384,354,384,354,354,384,354,355]; leapDays=[29,0,0,29,0,0,30,0,0,29, ...         0,29,0,0,30,0,0,29,0,30, ...         0,0,29,0,0,30,0,0,29,0, ...         29,0,0,29,0,0,30,0,30,0, ...         0,30,0,0,30,0,0,29,0,29, ...         0,0,30,0,0,30,0,29,0,0, ...         29,0,0,29,0,0,29,0,29,0, ...         0,29,0,0,29,0,29,0,0,30, ...         0,0,29,0,29,0,0,29,0,0, ...         29,0,0,29,0,29,0,0,29,0, ...         0,29,0,0,29,0,29,0,0,29, ...         0,0,29,0,29,0,0,30,0,0, ...         29,0,0,29,0,29,0,0,29,0, ...         0,29,0,29,0,0,30,0,0,29, ...         0,0,29,0,29,0,0,30,0,0]; leapMonth=[8,0,0,5,0,0,4,0,0,2, ...         0,6,0,0,5,0,0,2,0,7, ...         0,0,5,0,0,4,0,0,2,0, ...         6,0,0,5,0,0,3,0,7,0, ...         0,6,0,0,4,0,0,2,0,7, ...         0,0,5,0,0,3,0,8,0,0, ...         6,0,0,4,0,0,3,0,7,0, ...         0,5,0,0,4,0,8,0,0,6, ...         0,0,4,0,10,0,0,6,0,0, ...         5,0,0,3,0,8,0,0,5,0, ...         0,4,0,0,2,0,7,0,0,5, ...         0,0,4,0,9,0,0,6,0,0, ...         4,0,0,2,0,6,0,0,5,0, ...         0,3,0,7,0,0,6,0,0,5, ...         0,0,2,0,7,0,0,5,0,0];        offset=datenum(y,m,d)-datenum(1900,1,31)+1; dayCyl = offset + 40; monCyl = 14; cumLYearDays=cumsum([0,lYearDays]); LunarYear=find(offset>cumLYearDays); LunarYear=LunarYear(end); monCyl=monCyl+(LunarYear-1)*12;yearCyl = LunarYear+36; offset=offset-cumLYearDays(LunarYear); monthDays=[29,30]; monthDays=monthDays((bitand(lunarInfo(LunarYear),bitshift (65536,-(1:12)))~=0)+1); leap = leapMonth(LunarYear); if leap,     monthDays=[monthDays(1:leap),leapDays(LunarYear),monthDays(leap+1:end)]; end cumMonthDays=cumsum([0,monthDays]); LunarMonth=find(offset>cumMonthDays);LunarMonth=LunarMonth(end); offset=offset-cumMonthDays(LunarMonth); ch_run_ch=''; if leap      if  LunarMonth==(leap+1),ch_run_ch='闰'; end     if (LunarMonth>leap),LunarMonth=LunarMonth-1;end end monCyl=monCyl+LunarMonth; xx=['农历',Animals{rem(yearCyl-1,12)+1},'年',ch_run_ch,CnMonthStr{LunarMonth},'月',CnDayStr{offset}]; xx={xx;[cyclical(yearCyl),'年  ',cyclical(monCyl),'月  ',cyclical(dayCyl),'日']}; return function ganzhi=cyclical(num) Gan={'甲','乙','丙','丁','戊','己','庚','辛','壬','癸'}; Zhi={'子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥'}; ganzhi=[Gan{rem(num-1,10)+1},Zhi{rem(num-1,12)+1}]; 【 在 abcxyz2008 (木头) 的大作中提到: 】 : 各位,哪里有阴历与阳历的对照,我已知某一天的阳历日期,想知道阴历是多少,怎么 : 办?哪里有万年历? -- ※ 来源:·BBS 水木清华站 smth.org·[FROM: 211.68.38.167] 顺便把我自己的生日介绍一下,呵呵 >> LunarCalendar(1981,3,23)

ans =

    '农历鸡年二月十八'     '辛酉年  辛卯月  庚子日'

 

 

<script type="text/JavaScript"> alimama_pid="mm_10100948_184213_219218"; alimama_titlecolor="0000FF"; alimama_descolor ="000000"; alimama_bgcolor="FFFFFF"; alimama_bordercolor="E6E6E6"; alimama_linkcolor="008000"; alimama_bottomcolor="FFFFFF"; alimama_anglesize="0"; alimama_bgpic="0"; alimama_icon="0"; alimama_sizecode="31"; alimama_width=180; alimama_height=250; alimama_type=2; </script> <script src="http://a.alimama.cn/inf.js" type=text/javascript> </script>

系统集成项目管理工程师考试历年真题讲解

-
  • 1970年01月01日 08:00

农历 阴历 转换阳历算法

声明:代码来源于网络,只是改的易于阅读与理解而已 #include #include typedef struct _lunar{ int year; int month; ...
  • handyhuang
  • handyhuang
  • 2015-12-31 09:58:21
  • 2186

公历农历对照表,适用于数据库

  • 2009年01月13日 13:19
  • 174KB
  • 下载

如何利用自定义函数把阳历转换成阴历

数据库保存的是阳历日期,有时候会遇到把阳历换成阴历的需求,在报表开发过程中,可以首先定义一个可以将阳历转为阴历的类,然后自定义FineReport函数,在run方法中获取年月日参数并调用之前的类将阳历...
  • nayun123
  • nayun123
  • 2016-06-02 14:05:57
  • 6174

js实现阳历到阴历的转换

  • 2015年12月15日 17:10
  • 9KB
  • 下载

C#实现阳历转阴历的方法

 CREATE TABLE SolarData( yearId int not null, data char(7) not null, dataInt int not null)-...
  • changjiangzhibin
  • changjiangzhibin
  • 2008-04-19 03:38:00
  • 1799

阳历转换成阴历PHP实现详解

农历与阴历相关概念;阳历转换成阴历总体思路;怎样计算某一年的生肖;怎样计算天干地支;具体的程序实现;农历十六进制数据解析;为什么选择阳历1900.1.31作为参考点;怎样计算农历y年有多少天;PHP ...
  • hsd2012
  • hsd2012
  • 2016-06-20 17:52:28
  • 3062

JAVA中阳历与阴历时间转换

首先声明此方法来源于http://www.oschina.net/p/lunar-solar-calendar-converter  然后本人下载git上源码,经测试无任何问题,为方便以后使用记录一下...
  • mexican_jacky
  • mexican_jacky
  • 2016-05-30 14:18:32
  • 3570

C++阳历转阴历算法及实现

关于日历的一些基本常识: 阳历:每年12个月,1、3、5、7、8、10、12月都为31天;2月份平年28天,闰年((year%400==0)||(year%4==0&&year%100!=0))为2...
  • shufac
  • shufac
  • 2014-05-29 23:35:10
  • 1864

公历和阴历转换

javascript方法编写的html: 农历 content="农历; 阳历; 月历; 节日; 时区; 节气; 八字; 干支; 生肖; gregorian solar; chinese lunar;...
  • wanglex
  • wanglex
  • 2005-08-31 13:27:00
  • 2010
收藏助手
不良信息举报
您举报文章:阴历与阳历的对照
举报原因:
原因补充:

(最多只允许输入30个字)