答案 0 :(得分:0)
这将起作用:
import datetime
import math
def get_julian_datetime(date):
# Perform the calculation
julian_datetime = 367 * date.year - int((7 * (date.year + int((date.month + 9) / 12.0))) / 4.0) + int(
(275 * date.month) / 9.0) + date.day + 1721013.5 + (
date.hour + date.minute / 60.0 + date.second / math.pow(60,
2)) / 24.0 - 0.5 * math.copysign(
1, 100 * date.year + date.month - 190002.5) + 0.5
return julian_datetime
示例:
example_datetime = datetime.datetime(2015, 9, 26, 4, 30, 0)
print get_julian_datetime(example_datetime)