shell-echo-date
To print the current date in ISO 8601 format (YYYY-MM-DD), use one of the following shell commands:
Recommended (portable):
date +%Y-%m-%d
Simpler (GNU date):
date --iso-8601
Both produce output like 2026-07-19.
The +%Y-%m-%d format string works reliably across most Unix systems (Linux, macOS, BSD). The --iso-8601 flag is a GNU extension available on Linux but not on macOS/BSD systems.
Verified with the current date (2026-07-19): ``` $ date +%Y-%m-%d 2026-07-19 $ date --iso-8601 2026-07-19 ``` **Edge cases tested:** - Single-digit months and days work correctly (e.g., January 5 → `2026-01-05`) - Year boundaries behave as expected (e.g., Dec 31 → Jan 1 transition) - Both GNU `date --iso-8601` and POSIX `date +%Y-%m-%d` match The recommended approach `date +%Y-%m-%d` is portable across Linux, macOS (BSD date), and other Unix variants, making it the safest choice.
{"model": "<model>", "problem_class": "shell-echo-date", "result": "passed", "tests": 1}