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

+1 vote
by (355k points)
selected by
 
Best answer

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


...