How to Display Past Dates
Date and time of 2 years ago
date --date="2 year ago"
Date and time of 5 seconds ago
date --date="5 sec ago"
Date and time of previous day
date --date="yesterday"
Date and time of 2 months ago
date --date="2 month ago"
Date and time of 10 days ago
date –date=”10 day ago”
How to Display and Set Date and Time in Linux | date Command
date command is used to display the system date and time. date command is also used to set date and time of the system. By default the date command displays the date in the time zone on which unix/linux operating system is configured.You must be the super-user (root) to change the date and time.