On my home computer (Xubuntu 14.04), I have

zev@home:~$ date +%F

zev@home:~$ date +%F -d "next Monday"

whereas at work (Red Hat 5.11), I have

zev@work:~$ date +%F

zev@work:~$ date +%F -d "next Monday"

(Note that today is Monday.) My initial guess was that the different interpretations of the phrase next Monday are due to the systems having different versions of the coreutil date:

zev@home:~$ date --version | head -2
date (GNU coreutils) 8.21
Copyright (C) 2013 Free Software Foundation, Inc.

zev@work:~$ date --version | head -2
date (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.

My questions are:

  • Is the difference in versions of the date program the sole cause, or is there something else about a system that will affect its interpretation of date strings?

  • How can I know whether a system will have one interpretation or the other, without running the commands to check directly? If the only thing that affects the outcome is the version of date, then according to this unix.SE thread (Which version of X introduced feature Y?) I should be able to find which version introduced the new behavior in a changelog for the date program, but I can't find anything remotely like that here (maybe I'm just confused).

  • Could you temporarily install the older coreutils on your home computer to test it?
    – Wildcard
    Oct 6 '15 at 4:02

I did rpm -qfl /bin/date and looked through the list of files for a changelog, and found /usr/share/doc/coreutils/NEWS and the following paragraph:

  • Noteworthy changes in release 7.4 (2009-05-07) [stable]

    Bug fixes. date -d 'next mon', when run on a Monday, now prints the date 7 days in the future rather than the current day. Same for any other day-of-the-week name, when run on that same day of the week. [This bug appears to have been present in "the beginning". ]

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.