农历公历生日转换器

农历公历生日转换器可以帮助将农历日期转换为公历日期。

以下是一个简单的农历公历生日转换器,可以将农历日期输入为3位数字,输出为公历日期。请注意,此转换器仅供参考,可能存在误差。

```python。

from datetime import datetime, timedelta。

def convert_to_gregorian(chunqing):。

return datetime(year=int(chunqing[:4]), month=int(chunqing[4:6]), day=int(chunqing[6:8]))。

def convert_to_lunar(chunqing):。

year = int(chunqing[:4])。

month = int(chunqing[4:6])。

return ((35 + 3 * month) + year) % 121。

def convert_to_gregorian_with_chunqing(year, month, day):。

return convert_to_gregorian(str(year) + '年' + str(month) + '月' + str(day))。

def convert_to_lunar_with_chunqing(year, month, day):。

return convert_to_lunar(str(year) + '年' + str(month) + '月' + str(day))。

def convert_to_gregorian(birth_date):。

year, month, day = birth_date.split('年')。

return convert_to_gregorian_with_chunqing(int(year), int(month), int(day))。

def convert_to_lunar(birth_date):。

year, month, day = birth_date.split('年')。

return convert_to_lunar_with_chunqing(int(year), int(month), int(day))。

year = int(input('请输入农历年份:'))。

month = int(input('请输入农历月份:'))。

day = int(input('请输入农历日期:'))。

birth_date = str(year) + '年' + str(month) + '月' + str(day)。

result = convert_to_gregorian(birth_date)。

print('公历生日为', result)。

result = convert_to_lunar(birth_date)。

print('公历生日为', result)。

```。

使用方法:。

1. 将需要转换的农历日期作为参数传入函数。

农历 阳历 十月

您可能还会喜欢:
生日八字转换器
出生日期生辰八字转换器
星座日期农历阳历转换
出生日期转换生辰八字
出生日期转换生辰八字五行
出生日期转换生辰八字在线
出生日期转换生辰八字口诀
出生日期转换生辰八字怎么算五行
出生日期转换生辰八字对照表
星座按公历还是农历生日
星座按农历还是公历生日
星座看公历还是农历生日
星座的生日是公历还是农历
星座看什么农历还是公历生日
生日是什么星座看公历还是农历