You can use the
date
command to get the current date.
Example
To get the date in YYYY-mm-dd HH:MM:SS format:
datetime=$(date '+%Y-%m-%d %H:%M:%S')
Output
2022-10-10 11:30:30
Until next time…
Shabana Mukhtar
I write because…why not? (Stories, reviews, rants and more)