bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

no example of date -d 'the next occurrence of 17:30'


From: Dan Jacobson
Subject: no example of date -d 'the next occurrence of 17:30'
Date: Fri, 15 Aug 2003 01:25:27 +0800
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

The Info node "Relative items in date strings" and/or
"Examples of `date'" lack an example of how one can specify the next
occurrence of say 17:30.  I.e. if now the time is 15:00, our -d string
will print
$ date -d 'xxxxx'
Fri Aug 15 17:30:00 GMT-8 2003
but if now is 18:00, then the very same -d string will print
$ date -d 'xxxxx'
Sat Aug 16 17:30:00 GMT-8 2003

Tell the user what to use where I put xxxxx, or tell the user it is
impossible and he needs to what yyyy;zzzz shell script instead. 

No, it's not
$ date -d 'next 17:30'
date: invalid date `next 17:30'

If the best way to do it is

t=17:30
echo -n "The next occurrence of $t is "
if test `date +%s -d $t` -gt `date +%s`
then date
else date -d "$t tomorrow"
fi

then say so.



P.S. after the Date info pages, one hits
Toolbox Introduction
====================

   This month's column is only peripherally related to the GNU Project,

Hey, I'm reading Info.  Not a 'This month's column' ... please edit.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]