here is the snippet

data = ''2007-12-31 Name (mike) Age (34).....'
gregorian = time.strftime(data.split(" ")[0])
print gregorian
this gives me "2007-12-31"

i need to convert the gregorian date in the variable to julian date.
i tried this but it gives me the current date
julian = time.strftime('%j', time.localtime())

Python deals only with the Gregorian calendar. Certain terms (like "Julian") can be properly applied to specific things withing the Gregorian system, but the Julian calendar it is not.

Usually the Proleptic Gregorian calendar serves well enough for modern computing tasks...

Try googling "gregorian julian" for conversion algorithms. Good luck.

Unfortunately, the "Julian Day Number" is one of those terms I mentioned (or rather, it is often abused to mean "the day of the year").

Fortunately it looks like that link uses the JDN correctly! Nice catch!

This question has already been answered. Start a new discussion instead.