2

The following gives me Wednesday of the current week, i.e. yesterday's date.

date -v-wednesday  

I need the date of next week's Wednesday.
How can I do this?

4

Simple, change the minus to plus

date -v+wednesday
1

Almost, but you're not quite right with your description of -wednesday.

  • date -v Wednesday - Wednesday of the current week (past, current, or future)
  • date -v -Wednesday - last Wednesday (today, or up to six days ago)
  • date -v +Wednesday - next Wednesday (today, or up to six days in the future)

I notice that for "today" (in my case it's Thursday 21st June 2018), there is no difference in the date for -Thursday, +Thursday, or Thursday; they are all 21st June 2018.

What this means is that it is not possible to get directly to "today" one week in the future. Instead, you have to add one day, and then perform the offset calculation:

date -v +1d -v +Wednesday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.