My Clock Is Confused

Jacob Schmude jschmude at adelphia.net
Mon Oct 6 16:29:50 EDT 2003


Hi
Actually, there is a way to do it separately. Use the s switch to date. The format is:
date -s year-mm-dd
to set the date. Taking your provided example, it would look like:
date -s 2003-10-06
After that, you set the time in 24-hour format like this:
date -s hh:mm:ss
Again, taking your example, you would use:
date -s 14:40
Note that specifying the seconds is not necessary, but you can if you want. I've often found this easier than combining the two, especially when I only need 
to set one of them.
HTH
On Mon, 6 Oct 2003 14:48:17 -0500, Gregory Nowak wrote:

>Yeah, the syntax of date is pretty weird.
>
>In a nutshell, you want to pass 8 digits to the date command
>Digits 1 and 2 specify the month (I.E. 10 for October).
>
>Digits 3 and 4 specify the day (I.E. 06 for the 6th day of the month).
>
>Digits 5 and 6 specify the hour (I.E. 14 for 2 P.M.) (remember that
>you're dealing with a 24 hour clock here). It's possible to specify
>the hour in 12 hour format with an A or P at the end of the number
>string, but I've always used 24 hour format for this, so haven't tried
>the A or P myself.
>
>The final 7 and 8 digits specify the minute (I.E. 40 for the 40th
>minute).
>
>So, for example, if you wanted to set your clock to October 06th,
>14:40, you would do as root
>"date 10061440"
>and that should do it, preserving whatever time zone you've got set at
>the time. What I mean by that, is that only the hour/minute will
>change, but your time zone won't.
>






More information about the Speakup mailing list