>_ IzzyLab

Hands-on task

This task is step 6 of the course “Dates and times in the terminal”

Compute the deadline date

medium~5 min

The file /root/start.txt contains the project start date: 2024-01-15. The deadline is exactly 90 days after the start. Compute the deadline date and write it to /root/deadline.txt in the format YYYY-MM-DD.

What you'll practise:
  • date
  • relative dates
  • date arithmetic
  • date formatting

Topic breakdown

date understands relative intervals right inside the -d string: you can add and subtract days, weeks, and months to a base date with words, and the engine correctly steps across month and year boundaries itself. It's convenient to substitute the base date from a file into that same string. For the short YYYY-MM-DD output there's a ready-made format code %F.

What's checked

  1. deadline in 90 days is correct

What it looks like