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

📄 lunar_to_solar.m

📁 使用MATLAB编写的阴历和阳历转换程序
💻 M
字号:
%Lunar_to_Solar
%将农历日期转化为公历日期
lunar_daysofyear=lunar_day;                        %求该日是当农历年的第几天
if lunar_month~=1
    for k=1:lunar_month-1
        lunar_daysofyear=lunar_daysofyear+calendar_matrix(lunar_year-1935,k+2);
    end
end
solar_daysofyear=lunar_daysofyear+calendar_matrix(lunar_year-1935,1);
if solar_daysofyear>solar_sumofdays(13)            %该日公历年数比农历年数多一
    solar_daysofyear=solar_daysofyear-solar_sumofdays(13);
    solar_year=lunar_year+1;
end
solar_month=1;
while solar_daysofyear-1>solar_sumofdays(solar_month)
    solar_month=solar_month+1;
end
solar_month=solar_month-1;
solar_day=solar_daysofyear-solar_sumofdays(solar_month);
Get_Day_of_Week
fprintf('%1.0f年%1.0f月%1.0f日。\n',solar_year,solar_month,solar_day)

⌨️ 快捷键说明

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