Thursday, September 11, 2008

command line date time change

Or how to set the time in Linux.

Here's another thing I always forget: how to change the date or time at the command line, preferably using the Bourne shell in Linux.

Example:
To change the date/time on a Linux box to September 10, 2008 at 5:37pm, enter the following:
date 0910173708

The ordering of the fields is a bit odd, so pay attention.

where the date/time format is the following:
MMDDHHmmYY
MM - two digit month
DD - two digit day
HH - two digit hour
mm - two digit minute
YY - two digit year


All are zero padded if date/time values are below 10.

Changing the date time was never easier!

enjoy,
sodo

No comments:

Feel free to drop me a line or ask me a question.