Is there a straightforward way to parse date in Bash with year and month only, eg in format YYYY-mm
?
This does not work:
$ date -d "2022-12" +"%Y-%m"
date: invalid date ‘2022-12’
In Python, this works:
>>> from datetime import datetime
>>> datetime.strptime("2022-12", "%Y-%m")
datetime.datetime(2022, 12, 1, 0, 0)