[Top][All Lists]

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

Re: date rejects proper parameters with -s option

From: Bob Proulx
Subject: Re: date rejects proper parameters with -s option
Date: Sat, 20 Oct 2001 10:08:05 -0600

> My attempts to set the system date on my system have failed with the 
> following command:
> address@hidden log]# date -s 10200710
> date: invalid date `10200710'

Thanks for your report.  But you are just confusing the old style date
format MMDDhhmm[[CC]YY][.ss] which is a long set of numbers packed
closely together with a -s option which takes a human readable string.
The -s option is an extension to turn the unfriendly numbers into
normal times.

Instead of

  date -s 10200710

If you had *not* used the -s that would have worked.  (I didn't try
it.  But it looks like an old style date string.)

  date 10200710

That should have worked.  But it is hard to read and always hard to
remember exactly which order the numbers should be in.  And this is
exactly backwards from what many countries use as their normal

Therefore the -s option provides a newer interface to the old date
command.  It allows parsing of human style date strings.  See the info
pages for a complete description.

  info date

It expected something like

  date -s 'Sat Oct 20 10:05:42 MDT 2001'

> According to the docs ( --help, man and info ) the date command is 
> supposed to accept a command line of the type:
> date -s MMDDhhmm

Uh, where?  I can't find that anywhere.  Here is what it says.

date --help

Usage: date [OPTION]... [+FORMAT]
  or:  date [OPTION] [MMDDhhmm[[CC]YY][.ss]]

  -s, --set=STRING          set time described by STRING

info date

     Display the time and date specified in DATESTR instead of the
     current time and date.  DATESTR can be in almost any common
     format.  It can contain month names, timezones, `am' and `pm',
     `yesterday', `ago', `next', etc.  *Note Date input formats::.

     Set the time and date to DATESTR,  See `-d' above.

Note that date was updated extensively in 1999.  If you are using
sh-utils 2.0h or any other 2.0 version with a letter you might want to
update as there were many bugs fixed.  The latest test versions are
available at the following location.



reply via email to

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