Sample Header Ad - 728x90

How to use the 'date' command to display week number of the year?

25 votes
5 answers
61881 views
I want the UNIX date to output: So this is week 35 of 2016. Here, of course, 35 and 2016 are outputs of the date command. I have tried the following: date +%U This printed out the current week number. But I have to wrap it inside the specific text I want to display. I tried: date "So this is week: %U" date "It is currently: "+ "%U" Both gave me an error. How can I make the date command display the week number to me in the specific format that I desire?
Asked by learnerX (918 rep)
May 11, 2016, 08:15 PM
Last activity: Sep 8, 2023, 09:31 AM