I am looking for a solution in Python that I can use to convert the miladi date into shamsi using mathematical calculations
I looked for this on the internet, but there was only year conversion, and I used this code:
from datetime import datetime
def persian_time():
data = {'hour': datetime.now().hour,'min':datetime.now().minute,'year':datetime.now().year,'month':datetime.now().month,'day':datetime.now().day}
if data['month'] <= 3 and data['day'] <= 21:
result = 622
elif data['month'] <= 4 and data['day'] >= 22:
result = 621
return data['year'] - result
I did, but it only showed the year