This has to have a simple answer somewhere but cannot seem to find it for FreeBSD specifically.
Given this input:
I want to determine that this date is invalid. I first turned to the
But
Given this input:
Code:
DT='2022.02.30'
date
utility:
Code:
echo $DT ; date -j -f '%Y.%m.%d' $DT ; echo $?
2022.02.30
Wed Mar 2 15:56:22 EST 2022
0
But
date
helpfully converts the invalid date into a valid one and exits with success. Is there some way to get date to simply exit with a non-zero status instead? Or, is there some other utility of which I am unaware will will provide the same functionality?