Following are some illustrations of the date command.
date
# This prints the current date. Something of this form - "Tue Jan 31 12:16:53 IST 2006"
date +%d
# prints current day of the month
Following examples illustrate getting time related information of a day/date other than the current date
date --date="3 days ago"
# prints date that was 3 days ago
Try these too !
date --date="last Sunday"
date --date="next Sunday"
date --date="Jan 26, 2004" +%a
# prints Day of the week on Jan 26, 2004
Setting the system date. You need to have admin privileges to use --set option.
date --set='+10 minutes'
# Takes system clock forwad by 10 minutes.
Tuesday, May 02, 2006
Subscribe to:
Post Comments (Atom)
1 comment:
Do
man date
to learn more about the command and its options.
Post a Comment