Time and Date

Andrew Robinson awrobinson at cox.net
Sat May 29 19:18:09 UTC 2004


Don Dupy wrote:
> does anyone know a simple way to change the time and date
> on a FC1 machine in command line mode
> I don't have a gui installed
> 
> I don't quite understand the "date" command options
> 

Yeah, reading the date man page is more difficult than using the 
command. To set the time on your machine, _as_root_, enter something like:

date 05291542

That breaks down to May 29 at 3:42 pm. If you need to set the year, the 
man page seems to say append it to the end:

date 052915422004

That's different than I remember from other unices, but so it goes. To 
check the results of the command, just enter

date

Most of the other stuff in the man page deals with controlling the 
format of how date outputs the current time and date. This is very 
useful if you are writing scripts and need to include time and/or date 
in the output. For example, you could put a time stamp on a list of 
items with something like

date +"%Y%m%d%H%M%S"

to get "20040529154225". That would insure that the items would sort 
chronologically with the Linux sort command. But I've already told you 
more than you wanted to know...

Hope this helps.

Andrew Robinson





More information about the fedora-list mailing list