Wednesday, 4 January 2012

Linux Set Date and Time From a Command Prompt:

Here i am going to show how to check date and time using "date" command

  root@manivel-admin:~#  date
  Thu Mar 14 23:51:04 IST 2010

If it is showing wrong data and time, you can set date and time using following command

How to set date :

root@manivel-admin:~#  date   +%Y%m%d  -s   "20120104"

     -s   ----> set
    %Y ---> year
    %m  ----> month
    %d  ----> date

How to set time :

root@manivel-admin:~#   date   +%T%p  -s   "10:10:30AM"

     %T  ---> time
     %p  ---->either AM or PM


No comments:

Post a Comment