Use the date command to dispkay or set system date and time. Invoking date command with no FORMAT argument is equivalent to invoking it with a default format that depends on the LC_TIME locale category. Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command:
$ date
Sample outputs:
Tue Dec 7 03:08:34 IST 2010To display the date of the day before yesterday, enter:
$ date --date='2 days ago'
To display the date of the day three months and one day, enter:
$ date --date='3 months 1 day'
To display the current full month name and the day of the month:
$ date '+%B %d'
Anytime you need assistance with date command, turn to the man or info pages first. They give you detailed information, parameters and switches for date command. Just type man followed by the name of the command (i.e. date) to open the appropriate man page. For example, man date opens the man page for the date command:
$ man date
OR (may not work on OS X and other UNIX like systems)
$ info date
No comments:
Post a Comment