How does someone write a python function that converts a 'date' to the day of the year (e.g. Jan 31st would be the 'date' and 31 would be the day of year, Feb 1st would be the 'date' and 32 would be the day of year).
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions relating to general IT or with no clear GIS component, are off-topic here but can be researched/asked at Stack Overflow (software development), Super User (computing hardware and software), Database Administrators (relational databases) and other SE sites" – Dan C, nmtoken, Aaron
You can just format your date with
%j Day of the year as a zero-padded decimal number. 001, 002, …, 366
from datetime import date today = date.today() print today.strftime('%j')