how to get day of the year in shell?

bash, ksh, linux, shell

Solution

From the coreutils date manual:

%j     day of year (001..366)

Problem

How can I get the day of the year in shell? `date '+%V'` will give me the week of the year, which is 15 for today; but I need to find the day of the year!

Original source