I would like to change the date using the date command,I tried using [date -s set=Tue Jun 25 15:00:00 MST 2002] but it doesn't work, any suggestions would be very helpful.
You have to use the date command in this format...
date MMDDhhmmYY.ss
MM = Month
DD = Day
hh = hour
mm = minute
YY = year
.ss = seconds
The year and seconds are optional.
To change the date to 6/25/02, 6:40pm...
[root@penguin root]# date 0625184002.00
Tue Jun 25 18:40:00 EDT 2002
ChrisP ---------------------------------------
If someone's post was helpful to you, please click the box "Click here to mark this post as a helpful or expert post".
This is different. In Red Hat, your timezone is determined by the /etc/localtime file. This file should by linked to a file in /usr/share/zoneinfo/. The /usr/share/zoneinfo/ directory contains files for each time zone.
# First back up the /etc/localtime file
[root@penguin /]# mv /etc/localtime /etc/localtime.old
# Delete the /etc/localtime file
[root@penguin /]# rm -f /etc/localtime
# Lets change the timezone to Cuba's time
[root@penguin /]# ln -s /usr/share/zoneinfo/Cuba /etc/localtime
[root@penguin /]# date
Wed Jun 26 08:33:35 CDT 2002
# Lets change it back to US Eastern time (where I live)
[root@penguin /]# rm -f /etc/localtime
[root@penguin /]# ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime
[root@penguin /]# date
Wed Jun 26 08:34:40 EDT 2002
ChrisP ---------------------------------------
If someone's post was helpful to you, please click the box "Click here to mark this post as a helpful or expert post".
Oh, I just found a really easy solution to changing the timezone. From a command prompt, type 'timeconfig'. This gives you a simple menu for changing the time zone. This is on Red Hat, I'm not sure about other distro's.
ChrisP ---------------------------------------
If someone's post was helpful to you, please click the box "Click here to mark this post as a helpful or expert post".
how will i change the setting of time and date in my linux server coz when i type the date command i see the curent date but when i see the output on my scrip the date is not update. pls. help me
Which Linux distro and version? I think in earlier distro's you had to set the hardware clock too. I think you can do it with this command...
hwclock --systohc
ChrisP ------------------------------------------------------------------------------
If somebody helps you, please click the link in the botton left hand corner that says "Mark this post as a helpful/expert post".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.