1827174 Members
2227 Online
109716 Solutions
New Discussion

date and time

 
Joel Tolentino
Occasional Contributor

date and time

Simple question. hopefully. What's the command to change date and time. thanks.
6 REPLIES 6
Pete Randall
Outstanding Contributor

Re: date and time

"date"


Pete

Pete
sanwin
Frequent Advisor

Re: date and time

Hi Joel,
Basically the date command will itself will do it.
eg: date [mmddhhmm[[cc]yy]]

first mm is month
second mm is minutes
it will update to the latest date which is given as argument.

regards,
sanwin
James R. Ferguson
Acclaimed Contributor

Re: date and time

Hi Joel:

The safest way to correctly set the date and time is to use the '-u' option of 'date' and provide the correct UTC (GMT) date and time.

Sample the correct value from (for example):

http://tycho.usno.navy.mil/cgi-bin/anim

Be careful to stop all databases and time-sensitive processes if you are setting the time backwards! Databases and such do not take kindly to time appearing to run backwards :-)

Once you have set the correct date and time, keep it that way by running NTP (Network Time Protocol). There are numerous threads in this forum that discuss its setup.

Regards!

...JRF...
spex
Honored Contributor

Re: date and time

Hi Joel,

It is safer to slowly adjust the time via the '-a' option to 'date' than to jump to a new time.

date recognizes the following option:
-a [-]sss[.fff]
Slowly adjust the time by sss.fff seconds (fff represents
fractions of a second). This adjustment can be positive or
negative. The system's clock will be sped up or slowed down
until it has drifted by the number of seconds specified.

As mentioned, DBMS software should not be running if setting the time backwards.

PCS

Todd Goldsmith
New Member

Re: date and time

Since you are asking this question within a couple of days of a major change in daylight saving rules, are you looking to 'adjust' your HP-UX system time for that reason? If so, don't change the time! It will throw off all timezones on your machine. The tztab file does this automatically but you must have previously installed the tztab patch or modified your tztab file.
Reshma Malusare
Trusted Contributor

Re: date and time

date .. when you are superuser