Print the current system time in a form such as 2026-08-13 14:05:09.
Which command is appropriate?
date +FORMAT uses %Y-%m-%d for the date and %H:%M:%S for hour, minute, and second.
Detailed explanation
date '+%Y-%m-%d %H:%M:%S'Correct. The format prints year-month-day and hour:minute:second.
Correct. The format prints year-month-day and hour:minute:second.
date '+%y-%M-%d %h:%m:%s'Incorrect. It confuses month, minute, and other format directives.
Incorrect. It confuses month, minute, and other format directives.
hwclock '+%Y-%m-%d %H:%M:%S'Incorrect. hwclock does not use date's format argument this way.
Incorrect. hwclock does not use date's format argument this way.
timedatectl '+%Y-%m-%d %H:%M:%S'Incorrect. timedatectl does not accept date's format string.
Incorrect. timedatectl does not accept date's format string.
Try it yourself
An example you can run in a temporary verification environment.
date '+%Y-%m-%d %H:%M:%S'Expected result
4桁年-2桁月-2桁日 2桁時:2桁分:2桁秒Key points
- Use + to start format
- %m is month
- %M is minute
Notes
- Environment: GNU coreutils date / 読み取りのみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.