新华社天津1月17日电(记者周润健)近日,一则“2024年与1996年的公历日历完全一样”的消息引发公众关注。这两个年份的公历日历为啥会一模一样?听听天文科普专家怎么说。
中国天文学会会员、天津市天文学会理事杨婧介绍说,作为世界通用的纪年历,公历是根据地球围绕太阳公转一周即一个回归年的运动周期来制定的历法。一个回归年的长度是365.2422天,一年共12个月。由于回归年不是整数,公历便规定每4年增加1天,即公历的闰年,凡公历年数能被4除尽为闰年366天,除不尽则是平年365天,多的那一天安排在2月。
公历日历“撞脸”并不罕见,只要具备两个条件即可,元旦这天同是星期几、两年同是平年或闰年,比如2010年和2021年,这两年的元旦都是星期五,这两年又都是平年,所以这两年的日历自然就完全一样;2024年和1996年的元旦是星期一,这两年均为闰年,所以这两年的日历也会一模一样。
杨婧表示,如果公历只有平年没有闰年,日历“重合”的年份会很多,平均几年就会赶上一次,但由于有闰年的存在,日历“重合”的情况最多28年出现一次。
这是因为由换算可知,一年365天共有52个星期零1天,如果遇到闰年就是52个星期零2天。由于“每4年增加1天”,所以4年就会多出5天。这样一来,只有凑够了7个4年,也就是28年后,多出来的35天才能再次被7整除,从而把星期数重新移回来,完成一个循环。
但公历还规定,整世纪的年份(如1600年、1900年、2100年)如果可以被100整除但不能被400整除,仍为平年,能被400除尽才是闰年。基于“四年一闰,百年不闰,四百年再闰”的规律,公历每400年中不是有100个闰年,而是要扣除3个闰年,只有97个闰年。所以当出现整世纪年为平年时,就会打破4年多出5天的规律,导致公历日历“重合”的情况不是28年。
1996年和2024年的公历日历分布完全相同,农历日期是不是也完全相同?“农历日期并不相同。1996年的元旦对应的农历日期是十一月十一,而2024年的元旦对应的农历日期是十一月二十。由于这两个年份的第一天所对应的农历日期不同,剩下的365天所对应的农历日期自然也就不会相同。”杨婧说。
来源: 新华网
Public Function LTG(Optional xx_date As Date, Optional irow As Integer) '农历转公历
Dim LunarYear, LunarMonth, LunarDay
Dim NongliData(100)
'农历数据
NongliData(0) = 2635
NongliData(1) = 333387
NongliData(2) = 1701
NongliData(3) = 1748
NongliData(4) = 267701
NongliData(5) = 694
NongliData(6) = 2391
NongliData(7) = 133423
NongliData(8) = 1175
NongliData(9) = 396438
NongliData(10) = 3402
NongliData(11) = 3749
NongliData(12) = 331177
NongliData(13) = 1453
NongliData(14) = 694
NongliData(15) = 201326
NongliData(16) = 2350
NongliData(17) = 465197
NongliData(18) = 3221
NongliData(19) = 3402
NongliData(20) = 400202
NongliData(21) = 2901
NongliData(22) = 1386
NongliData(23) = 267611
NongliData(24) = 605
NongliData(25) = 2349
NongliData(26) = 137515
NongliData(27) = 2709
NongliData(28) = 464533
NongliData(29) = 1738
NongliData(30) = 2901
NongliData(31) = 330421
NongliData(32) = 1242
NongliData(33) = 2651
NongliData(34) = 199255
NongliData(35) = 1323
NongliData(36) = 529706
NongliData(37) = 3733
NongliData(38) = 1706
NongliData(39) = 398762
NongliData(40) = 2741
NongliData(41) = 1206
NongliData(42) = 267438
NongliData(43) = 2647
NongliData(44) = 1318
NongliData(45) = 204070
NongliData(46) = 3477
NongliData(47) = 461653
NongliData(48) = 1386
NongliData(49) = 2413
NongliData(50) = 330077
NongliData(51) = 1197
NongliData(52) = 2637
NongliData(53) = 268877
NongliData(54) = 3365
NongliData(55) = 531109
NongliData(56) = 2900
NongliData(57) = 2922
NongliData(58) = 398042
NongliData(59) = 2395
NongliData(60) = 1179
NongliData(61) = 267415
NongliData(62) = 2635
NongliData(63) = 661067
NongliData(64) = 1701
NongliData(65) = 1748
NongliData(66) = 398772
NongliData(67) = 2742
NongliData(68) = 2391
NongliData(69) = 330031
NongliData(70) = 1175
NongliData(71) = 1611
NongliData(72) = 200010
NongliData(73) = 3749
NongliData(74) = 527717
NongliData(75) = 1452
NongliData(76) = 2742
NongliData(77) = 332397
NongliData(78) = 2350
NongliData(79) = 3222
NongliData(80) = 268949
NongliData(81) = 3402
NongliData(82) = 3493
NongliData(83) = 133973
NongliData(84) = 1386
NongliData(85) = 464219
NongliData(86) = 605
NongliData(87) = 2349
NongliData(88) = 334123
NongliData(89) = 2709
NongliData(90) = 2890
NongliData(91) = 267946
NongliData(92) = 2773
NongliData(93) = 592565
NongliData(94) = 1210
NongliData(95) = 2651
NongliData(96) = 395863
NongliData(97) = 1323
NongliData(98) = 2707
NongliData(99) = 265877
NongliData(100) = 1706
Dim m, monthCount, toCurMonthCnt, LeapMonth, theDate, curTime
Dim i1, i2, i3, bit
'获取当前变量日期
curTime = xx_date
'LunarYear = Year(curTime)
LunarYear = Year(Now())
LunarMonth = Month(curTime)
LunarDay = Day(curTime)
m = LunarYear - 1921
monthCount = 0
toCurMonthCnt = 0
LeapMonth = -1
theDate = LunarDay - 1
For i1 = 0 To m - 1 Step 1
If (NongliData(i1) < 4095) Then
monthCount = 11
Else
monthCount = 12
End If
For i2 = 0 To monthCount Step 1
bit = NongliData(i1)
For i3 = 1 To i2 Step 1
bit = Int(bit / 2)
Next
bit = bit Mod 2
theDate = theDate + 29 + bit
Next
Next
If (NongliData(m) < 4095) Then
monthCount = 11
toCurMonthCnt = monthCount - LunarMonth + 2
Else
monthCount = 12
toCurMonthCnt = monthCount - LunarMonth + 1
LeapMonth = Int(NongliData(m) / 65536)
If LunarMonth <= LeapMonth Then toCurMonthCnt = toCurMonthCnt + 1
End If
For i2 = monthCount To toCurMonthCnt Step -1
bit = NongliData(m)
For i3 = 1 To i2 Step 1
bit = Int(bit / 2)
Next
bit = bit Mod 2
theDate = theDate + 29 + bit
Next
LTG = DateAdd("d", theDate, "1921/2/8")
If irow = 1 Then
Sheet1.Cells(1, 10) = "'" & LTG
Else
Sheet1.Cells(irow, 4) = "'" & LTG
End If
End Function
Private Sub CommandButton1_Click()
If IsDate(Sheet1.Cells(1, 9)) = True And IsNull(Sheet1.Cells(1, 9)) = False And Sheet1.Cells(1, 9) <> "" Then
aaa = LTG(Sheet1.Cells(1, 9), 1)
End If
Dim i As Integer
For i = 2 To 100
Sheet1.Cells(i, 4) = ""
If Sheet1.Cells(i, 2) <> "" And IsNull(Sheet1.Cells(i, 2)) = False And IsDate(Sheet1.Cells(i, 2)) = True Then
If Sheet1.Cells(i, 3) = "Y" Then
bbb = LTG(Sheet1.Cells(i, 2), i)
Else
Sheet1.Cells(i, 4) = "'" & Sheet1.Cells(i, 2)
End If
Else
Application.DisplayAlerts = False
Application.Quit
End If
Next i
End Sub
私信回复关键词【学一招】,一次性 Get 学一招合集!助你成为高效职场人!
分不清「公历」和「农历」的烦恼无处不在。
比如从小只过「公历」生日的小 E,身边有一大群只过「农历」生日的朋友。每次小 E 都要翻 N 遍黄历,以确保不在错误的时间送上祝福。
还有过年放假,家里人总说「初三去大姨那儿拜年,初四去大姑家」。小E只能看着台历,从大年三十数到正月初三。
再比如一直认为农历七夕指的是 7 月 7 日。
……
如果你也有类似的烦恼,那么今天要学的这一招,一定能帮上你——用 Excel 将公历转农历!
公历转农历只需要一个简单的公式:
=TEXT(A2,\"[$-130000]yyyy-m-d\")
其中,A2 表示要转化的公历日期;
yyyy-m-d 表示输入日期的格式;
[$-130000] 是表示公历转阴历的特殊参数。
操作方法:
❶ 先点选单元格,输入上述公式:
❷ 输入完公式后,只要按下【回车】键,再双击单元格右下角的「填充柄」,快速填充,对应的农历日期就全部转换完成!
例如:今天是公历 2019/7/3,那么对应的农历日期就为 2019-6-1:
美中不足的是,该公式只适用于 Excel 2010 以上的版本,且无法计算出闰月。
你还有其他转换方法吗?可以在留言区告诉小 E!
私信回复关键词【学一招】,一次性 Get 学一招合集!助你成为高效职场人!
农历年换算成公历年
农历年由天干地支两个序列组成,我们姑且称天干为A序列,地支为B序列。A:甲1 乙2 丙3 丁4 戊5 己6 庚7 辛8 壬9 癸10(0)B:子1 丑2 寅3 卯4 辰5 巳6 午7 未8 申9 酉10 戌11 亥12(0)
如果A-B>=0,则按下式计算:
(A-B)*5+3+A
如果A-B<0 ,则按下式计算:(A-B+10)*5+13+A
例一,求癸卯年公历:(10-4)*5+3+10=43,0043年为公元后第一个癸卯年,由于农历年份每过60重复一次,依次类推,2023年也是癸卯年。
公历年换算成农历年
农历年由天干地支两个序列组成,我们姑且称天干为A序列,地支为B序列。A:甲1 乙2 丙3 丁4 戊5 己6 庚7 辛8 壬9 癸10(0)B:子1 丑2 寅3 卯4 辰5 巳6 午7 未8 申9 酉10 戌11 亥12(0)
A系列由公历年份+7的个位数求得,B系列由年份+57÷12的余数求得。
例一,求1911年农历:1911+7=1918,由8求得A系列为辛;1911+57=1968,1968÷12=164…0,由0求得B系列为亥,1911年为农历辛亥年。
例二,求0001年农历:
1+7=8,1+57=58,58÷12=4…10,0001年为农历辛酉年。
如果是公元前的年份,由于没有公元0年,直接计算比较困难,方法是公元前年份+1,再加上60的整倍数,转换成公元后年份,再行计算。
例一,求公元前一年农历:
-1+1+60=60,结论是庚申年。
例二,求-1911年农历:
-1911+1+32×60=10,结论公元前1911年为农历庚午年。
例二,求辛亥年公历:(8-12+10)*8=51,0051年为公元后第一个辛亥年,同样依次类推,1911年也是辛亥年。
这里要注意,求出公元后第一个农历年份所对应的公历年,通常是加上若干个60的整数倍,但这只限于往后推算。如果是往前推算,那就是公元前了,由于没有公元0年,必须先减1再减去若干个60的整数倍。5+13+
例三,求公元前最后一个辛酉年的公历:1-1-60=-60,结论是公元前60年。
例四,求公元前2000后第一个辛亥年:51-1-34*60=-1990,结论是公元前1990年。
Public Function LTG(Optional xx_date As Date, Optional irow As Integer) '农历转公历
Dim LunarYear, LunarMonth, LunarDay
Dim NongliData(100)
'农历数据
NongliData(0) = 2635
NongliData(1) = 333387
NongliData(2) = 1701
NongliData(3) = 1748
NongliData(4) = 267701
NongliData(5) = 694
NongliData(6) = 2391
NongliData(7) = 133423
NongliData(8) = 1175
NongliData(9) = 396438
NongliData(10) = 3402
NongliData(11) = 3749
NongliData(12) = 331177
NongliData(13) = 1453
NongliData(14) = 694
NongliData(15) = 201326
NongliData(16) = 2350
NongliData(17) = 465197
NongliData(18) = 3221
NongliData(19) = 3402
NongliData(20) = 400202
NongliData(21) = 2901
NongliData(22) = 1386
NongliData(23) = 267611
NongliData(24) = 605
NongliData(25) = 2349
NongliData(26) = 137515
NongliData(27) = 2709
NongliData(28) = 464533
NongliData(29) = 1738
NongliData(30) = 2901
NongliData(31) = 330421
NongliData(32) = 1242
NongliData(33) = 2651
NongliData(34) = 199255
NongliData(35) = 1323
NongliData(36) = 529706
NongliData(37) = 3733
NongliData(38) = 1706
NongliData(39) = 398762
NongliData(40) = 2741
NongliData(41) = 1206
NongliData(42) = 267438
NongliData(43) = 2647
NongliData(44) = 1318
NongliData(45) = 204070
NongliData(46) = 3477
NongliData(47) = 461653
NongliData(48) = 1386
NongliData(49) = 2413
NongliData(50) = 330077
NongliData(51) = 1197
NongliData(52) = 2637
NongliData(53) = 268877
NongliData(54) = 3365
NongliData(55) = 531109
NongliData(56) = 2900
NongliData(57) = 2922
NongliData(58) = 398042
NongliData(59) = 2395
NongliData(60) = 1179
NongliData(61) = 267415
NongliData(62) = 2635
NongliData(63) = 661067
NongliData(64) = 1701
NongliData(65) = 1748
NongliData(66) = 398772
NongliData(67) = 2742
NongliData(68) = 2391
NongliData(69) = 330031
NongliData(70) = 1175
NongliData(71) = 1611
NongliData(72) = 200010
NongliData(73) = 3749
NongliData(74) = 527717
NongliData(75) = 1452
NongliData(76) = 2742
NongliData(77) = 332397
NongliData(78) = 2350
NongliData(79) = 3222
NongliData(80) = 268949
NongliData(81) = 3402
NongliData(82) = 3493
NongliData(83) = 133973
NongliData(84) = 1386
NongliData(85) = 464219
NongliData(86) = 605
NongliData(87) = 2349
NongliData(88) = 334123
NongliData(89) = 2709
NongliData(90) = 2890
NongliData(91) = 267946
NongliData(92) = 2773
NongliData(93) = 592565
NongliData(94) = 1210
NongliData(95) = 2651
NongliData(96) = 395863
NongliData(97) = 1323
NongliData(98) = 2707
NongliData(99) = 265877
NongliData(100) = 1706
Dim m, monthCount, toCurMonthCnt, LeapMonth, theDate, curTime
Dim i1, i2, i3, bit
'获取当前变量日期
curTime = xx_date
'LunarYear = Year(curTime)
LunarYear = Year(Now())
LunarMonth = Month(curTime)
LunarDay = Day(curTime)
m = LunarYear - 1921
monthCount = 0
toCurMonthCnt = 0
LeapMonth = -1
theDate = LunarDay - 1
For i1 = 0 To m - 1 Step 1
If (NongliData(i1) < 4095) Then
monthCount = 11
Else
monthCount = 12
End If
For i2 = 0 To monthCount Step 1
bit = NongliData(i1)
For i3 = 1 To i2 Step 1
bit = Int(bit / 2)
Next
bit = bit Mod 2
theDate = theDate + 29 + bit
Next
Next
If (NongliData(m) < 4095) Then
monthCount = 11
toCurMonthCnt = monthCount - LunarMonth + 2
Else
monthCount = 12
toCurMonthCnt = monthCount - LunarMonth + 1
LeapMonth = Int(NongliData(m) / 65536)
If LunarMonth <= LeapMonth Then toCurMonthCnt = toCurMonthCnt + 1
End If
For i2 = monthCount To toCurMonthCnt Step -1
bit = NongliData(m)
For i3 = 1 To i2 Step 1
bit = Int(bit / 2)
Next
bit = bit Mod 2
theDate = theDate + 29 + bit
Next
LTG = DateAdd("d", theDate, "1921/2/8")
If irow = 1 Then
Sheet1.Cells(1, 10) = "'" & LTG
Else
Sheet1.Cells(irow, 4) = "'" & LTG
End If
End Function
Private Sub CommandButton1_Click()
If IsDate(Sheet1.Cells(1, 9)) = True And IsNull(Sheet1.Cells(1, 9)) = False And Sheet1.Cells(1, 9) <> "" Then
aaa = LTG(Sheet1.Cells(1, 9), 1)
End If
Dim i As Integer
For i = 2 To 100
Sheet1.Cells(i, 4) = ""
If Sheet1.Cells(i, 2) <> "" And IsNull(Sheet1.Cells(i, 2)) = False And IsDate(Sheet1.Cells(i, 2)) = True Then
If Sheet1.Cells(i, 3) = "Y" Then
bbb = LTG(Sheet1.Cells(i, 2), i)
Else
Sheet1.Cells(i, 4) = "'" & Sheet1.Cells(i, 2)
End If
Else
Application.DisplayAlerts = False
Application.Quit
End If
Next i
End Sub
copyright © 2022 一生命运网 版权所有 辽ICP备2022007116号-4
法律声明:本站文章来自网友投稿,不代表本站观点,版权归原创者所有,如果侵犯了你的权益,请通知我们,我们会及时删除侵权内容!