SyntaxHighlighter

Wednesday, July 30, 2008

Julian Day in Python

I found very little documentation on obtaining the Juilian day with the time module in Python. So this is how it's done:
import time

print time.strftime("%j")

As easy as that!

2 comments:

Unknown said...

I've since realized that the Julian day is actually a different format, and the day referred to in this article is the ordinal date (http://en.wikipedia.org/wiki/ISO_8601#Ordinal_dates).

Willem said...

You should have asked me ;-)

import datetime
datetime.datetime.timetuple () [7]