+2 votes
in Operating Systems by (67.2k 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 (286k 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