+2 votes
in Operating Systems by (15.3k points)

I want to get date time in YYYY-MM-DD HH:MM:SS format in my script. Is there any way to format the output of date command?

1 Answer

0 votes
by (29.1k points)

You can format the output of the date command to get datetime in YYYY-MM-DD HH:MM:SS format.

$ date +"%Y-%m-%d %T"
2019-09-11 19:18:31