Linux Classes
Share This With a Friend  

How Can I Set the Date and Time on Linux?

What's Today's date?

Use the date command to print the current date and time. If you add the -u flag, the results will be for the Greenwich mean time zone. And if you log in as a superuser, you can even change the date or time with the -s flag. Now, that's power!

Here are some examples:

date Print the date and time.
Sat Nov 2 20:09:43 EST 1996
date -u Print the GMT date and time.
Sun Nov 3 01:09:45 GMT 1996
date -s 0503 Set the clock to 5:03 A.M.

For more information on the date command, see the date manual.

Previous Lesson: Who is Logged In?
Next Lesson: The Echo Command



Comments - most recent first
(Please feel free to answer questions posted by others!)

GUPTHA     (18 Oct 2012, 18:11)
hai sir to apply jobs best websites send to my mail in windows7 how to use vmware
sandeep kumar     (05 Sep 2012, 09:22)
hi sir,
i m student of final .i want learn linux shell scripting .
so kindelly send me Linux tutorial who help me during learning
nikhil     (18 Mar 2012, 06:23)
i want to know about the process of the booting nd ways of changing the process of booting ?
Majed     (08 Aug 2011, 10:38)
@Mauro you probably have a problem with the time zone in gentoo i checked the file /etc/conf.d/clock and changed the time zone and something to do with the hardware clock
Majed     (08 Aug 2011, 09:06)
this string should be included as example :
date -s "8 AUG 2011 16:06:00"
Majed     (08 Aug 2011, 08:59)
i had my time wrong on gentoo so thanks for the tip on how to change time because i didn't find the time to lookup the command on the internet. However, you should include in the example of how to change date too and from +3 to +2, because the help doesn't provide information on how to write the string.
Mauro     (01 Feb 2011, 12:18)
hi, when i installed linux (debian) i made a mistake setting the utc time. now even if set the utc time with date -u -s <time>, at the next reboot the time returns to the older. i also tried with hwclock but i get a time-out error and dpkg-reconfigure tzdata only reconfigure local time. therefore every time i boot i have to change manually the time. how i can definitely fix this problem with no linux reinstallation? thks
jim     (24 Aug 2010, 02:37)
i want to learn do i need more software?
TooCool     (01 Aug 2010, 02:43)
This is really great....thnx a ton
Thanakorn     (05 May 2010, 02:49)
very good knowledge

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
Notify me about new comments on this page
Hide my email

Ask Bob Rankin - Free Tech Support

Copyright © by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.