1
我是Python新手。以下代碼可以正常工作以取得當前Julian日期並減去90天以獲得當天Julian日期。我只是好奇,如果有更好的方式來寫這段代碼?獲取Julian約會的更好方法?
def jninety_date(self):
today = int(time.strftime("%j"))
year = int(time.strftime("%y"))
jdate = today - 90
if jdate <= 0:
jdate = 365 - abs(jdate)
year -= 1
return "Julian Date: " + str(year) + " " + str(jdate)
elif jdate < 99:
return "Julian Date: " + str(year) + " 0" + str(jdate)