how to get day of the year in shell?

后端 未结 2 769
名媛妹妹
名媛妹妹 2021-01-03 21:07

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 t

相关标签:
2条回答
  • 2021-01-03 21:31

    Use the date command and the %j option...

    doy=$(date +%j)
    
    0 讨论(0)
  • 2021-01-03 21:46

    From the coreutils date manual:

    %j     day of year (001..366)
    
    0 讨论(0)
提交回复
热议问题