There is a problem with DOY, Month, day.
Today is june, 8th but the script tool swaps month with day and, for this reason, also the DAYOFYEAR give to me the wrong value as result.
I thinks that this is probably related to a known issue (defect 41384) where the date format in the script editor debug window is not correct based on the Windows regional settings. This is only an issue with the script debug and the values appear correctly during runtime.
This issue is noted in the 3.0.1, 3.0.2., 3.1.1 etc release notes.