How to change the system date in Linux

A friend needed help changing the system date on his Linux box today. This is usually a simple task for Linux users but newbies tend to get confused by the "date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]" line in the man page.

To simplify, this is how you do it.

Set the current date to April 7 2008 8:42:45pm.

The easy way,

#date -s "7 April 2008 20:42:45"

The harder way,

#date 040720422008.45

The break down: MM DD hh mm YYYY ss

MM = month = 04

DD = day = 07

hh = hour = 20

mm = minute = 42

YYYY = year = 2008

ss = second = 450

sample output,

[root@klmsyslog01p ~]# date -s "7 April 2008 20:42:45"
Mon Apr 7 20:42:45 MYT 2008
[root@klmsyslog01p ~]#

[root@kmmserver01p ~]# date 040720422008.45
Mon Apr 7 20:42:45 MYT 2008
[root@kmmserver01p ~]#

One Response to “How to change the system date in Linux”

Author comments are in a darker gray color for you to easily identify the posts author in the comments

  1. Steven Russo says:

    Hi! I’m looking for both SEO and Linux admin help. If you are interested, please hit me up here! Also, if anyone knows of any open source solutions like the one located at http://www.trickylinux.com, I’d love to know about it!Thanks!Steven

Leave a Reply

© 2008-2009 The Danesh Project
Powered by Wordpress and made by Guerrilla. Best viewed in Mozilla Firefox