There are many ways to change the system date in linux but i think following method is bit easier than others.
# date -s "31 JAN 2009 22:19:53"
-s option used to set the date.
In every case above example is sufficient .However you can use below commands for your knowledge.
# date +%T -s "23:20:57"
# date +%T%p -s "11:20:57PM"
Display Date in different format:
I would recommend to use following format while using date variable in your script.
#date '+%F-%I-%M-%S-%p'
2011-04-01-10-25-33-AM
-F : full date same as %Y-%m-%d
-I : hour (01..12)
-M : minute (00..59)
-S : second (00..60)
-p : localeâs equivalent of either AM or PM; blank if not known
Coming soon...
Please Leave us with your comments and Queries/Suggestions.
I will try to reply asap.
No comments:
Post a Comment