Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 859
  • Last Modified:

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
0
dekoay
Asked:
dekoay
1 Solution
 
paulqnaCommented:
To enter a date for 25th of december at 23:15 do:

date 12252315

or do:

man date

to see all the other options available...

0
 
ahoffmannCommented:
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
0
 
svindlerCommented:
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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
aman66Commented:
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/
0
 
ahoffmannCommented:
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)
0
 
dekoayAuthor Commented:
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.
0
 
CleanupPingCommented:
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.
0
 
ahoffmannCommented:
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
0
 
drewberCommented:
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:
http://www.experts-exchange.com/help/closing.jsp
 
drewber
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now