One of the things I find frustrating in work is the use of the day of the year to determine when a transaction was input. Other places may refer to it by date. I'm stuck thumbing through a calendar to double check that the day of the year corresponds to that date. If only there was easy way to look it up ...
I read there is a way to do it in EXCEL, but that isn't as much fun as wasting a couple days adding a page to my site.
I knew there was field used by the time functions “tm_yday”. I figured I could set it, call a fuction, and output the result. It turns out that “mktime” can't initialize the “struct tm” using this field. However, I found an example online for how to work around it.
If you set “tm_day” to the day of the year, set “tm_month” to 0 (January), and call “mktime”, it will set “tm_yday” and normalize “tm_month” and “tm_day”.
Month, day and year should all be positive integers. Month must be 1 through 12.
Weeks are in the range of 1 through 53. Week 1 is the first week of the year with a Monday. If the year doesn't start until Tuesday, the beginning of the year is treated as week 53 of the previous year.