农历公历生日转换器

农历公历生日转换器是一种将农历日期转换为公历日期的工具。以下是一个简单的农历公历生日转换器,你可以使用它来将农历日期转换为公历日期。

```python。

import datetime。

def convert_农历_to_公历(birth_date_str):。

year = int(birth_date_str[:4])。

month = int(birth_date_str[5:7])。

day = int(birth_date_str[8:10])。

birth_year = year - 1911。

birth_month = month - 1。

birth_day = day。

return birth_year, birth_month, birth_day。

def convert_公历_to_农历(birth_year, birth_month, birth_day):。

year = birth_year + 1911。

month = birth_month + 1。

day = birth_day。

return (year, month, day)。

# 测试。

birth_date_str = "1990/03/01"。

birth_year, birth_month, birth_day = convert_农历_to_公历(birth_date_str)。

print(f"农历生日:{birth_date_str},公历生日:{birth_year}/{birth_month}/{birth_day}")。

birth_date_str = "2001/01/01"。

birth_year, birth_month, birth_day = convert_公历_to_农历(birth_date_str)。

print(f"农历生日:{birth_date_str},公历生日:{birth_year}/{birth_month}/{birth_day}")。

```。

这个程序将输入一个农历日期字符串(例如"1990/03/01"),然后将其转换为公历日期。你可以通过修改`convert_农历_to_公历`函数和`convert_公历_to_农历`函数来支持更复杂的输入。请注意,这个转换器并不完美,例如农历日期中的小数部分可能不会正确处理。

阳历 农历

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