Link to home
Start Free TrialLog in
Avatar of dekoay
dekoay

asked on

Set Date in Linux

Hello Linux Experts,

Perhaps I would like to ask how I can set date in linux ?
For eg, in Dos, we can use

C:>Date
   Current date is 0-03-2002
   Enter new date (mm-dd-yy) : _


So for linux how do we set it ?

Thank you
Derrick Koay
ASKER CERTIFIED SOLUTION
Avatar of paulqna
paulqna
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
keep in mind that  date  , unlike to DOS' date, just sets the OS' time, the BIOS clock (RTC) remains unchanged.
Also see  man date  and check for the  -u  option.

If you want to st the RTC, see   man hwclock
Avatar of svindler
svindler

I strongly suggest you use ntp to set the time.
This automatically updates your clock, using publicly accessible time servers.
See www.ntp.org for more info.
use command as below
1)date -s hh:mm:ss
2)/sbin/clock -w


explain:
1)modify time
2)write to Hardware Clock(BIOS)


http://linuxnews.idv.tw/
http://forum.linuxnews.idv.tw/
aman66, would you please post your suggestions as comments, and not as answers.
Let the questioner decide to grade the comment of her/his choice as answer.
Please read the EE Policies if unshure.
Thanks (no offence, just a kindly reminder)
Avatar of dekoay

ASKER

amanda66,

thanx for the answer, but what I need is to set both time and date. Paulqna answer is more accurate as I had solved the problem with its way.
dekoay:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
answer depends on the questioner's intent:
  - setting time/date in OS only --> date
     paulqna gave the answer
  - setting time/date in BIOS (independent of Linux): --> date -u   or  hwclock
     ahoffmann gave an answer
This question has been classified abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.
 

Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

 
If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp
 
drewber