Hi,
I saw some info on displaying custom date using date -d sting. How do I use it on Linux operating system?
Hi,
I saw some info on displaying custom date using date -d sting. How do I use it on Linux operating system?
The default is now which shows the current date and time
date -d 'now'
Above is same as typing
date
The date -d ‘string’ show the date and time specified in datestr instead of the current date and time. datestr can be in almost any common format. It can contain month names, time zones, ‘am’ and ‘pm’, ‘yesterday’.
Print the date of the day before yesterday:
date -d '1 day ago'
date --date='2 days ago'
Try some more:
date -d '1 month ago'
date -d '1 year ago'
date -d 'yesterday'
date -d 'tomorrow'
For more info see my tutorials: