LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-23-2003, 03:48 AM   #1
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Rep: Reputation: 30
how set system time by command prompt?


how to set a system date using a command prompt?
let say i wan to set the system to be 2003, July, 05, 10:10... how?
 
Old 08-23-2003, 04:09 AM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
you can do it with the date command, forgotten the argument though so you'll have to look in the man page.

man date
 
Old 08-23-2003, 04:55 AM   #3
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
for 2003, July, 05, 10:10

that should be:

date 070510102003

which means mm,dd,time,year
 
Old 08-23-2003, 08:49 AM   #4
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Original Poster
Rep: Reputation: 30
okie... thanks... for help
 
Old 08-23-2003, 09:00 AM   #5
nadine.mauch
Member
 
Registered: Aug 2003
Location: France
Distribution: SuSE 7.2/8.1/8.2/9.0/9.1
Posts: 81

Rep: Reputation: 15
I use the command date -s
Example : to set date to the 21st august 2003
date -s 210803 +DDMMYY
^-------------^
format
date -s 1535 +HHMM sets time to 15:35
 
Old 08-24-2003, 06:41 PM   #6
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Original Poster
Rep: Reputation: 30
then, how to display the two digits of the year?
 
Old 08-24-2003, 06:48 PM   #7
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Original Poster
Rep: Reputation: 30
date +%Y will yield me a string 2003... if i want to display 03, then how?
 
Old 08-24-2003, 06:48 PM   #8
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
I prefer NTP, or it's sister NTPdate. Works great! Check out www.ntp.org

Cool
 
Old 08-25-2003, 02:53 AM   #9
nadine.mauch
Member
 
Registered: Aug 2003
Location: France
Distribution: SuSE 7.2/8.1/8.2/9.0/9.1
Posts: 81

Rep: Reputation: 15
To display the last two digits of the current year
date +%y

(y lowercase=last two digits, Y uppercase=full year)
 
Old 08-25-2003, 06:40 PM   #10
yenonn
Member
 
Registered: Feb 2003
Location: Malaysia
Distribution: Redhat 8.0, 9, Slackware 9.1
Posts: 511

Original Poster
Rep: Reputation: 30
oh....okie.... thanks for ur help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set and sync system time with time server?? servnov Linux - Newbie 6 12-03-2013 07:55 PM
set system time xushi Slackware 3 03-31-2005 08:56 AM
Erm, how do I set my system date/time? vasudevadas Slackware 4 09-14-2004 03:40 PM
date command do not keep time set shanenin Linux - Software 1 09-04-2004 08:16 PM
Where do I edit the system wide command prompt? Brakki Linux - General 1 04-13-2004 12:02 AM


All times are GMT -5. The time now is 11:45 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration