Today my clock was automatically adjusted to summer time, and a script from a crontab started failing. I had a look at what was happening, and the following error was being displayed, with LC_ALL=C:date: invalid date '2016-10-16'I though it would be best just to reboot the system, but now I have rebooted, and the error still appears:$ date -d '2016-10-15'Sat Oct 15 00:00:00 BRT 2016$ date -d '2016-10-16'date: data invlida 2016-10-16$ date -d '2016-10-17'Mon Oct 17 00:00:00 BRST 2016What could be causing this?
Error message date: invalid date '2016-10-16'
date;timezone
The problem is the daylight saving time changed and forwarded 1 hour, on 16 October 2016 in your timezone:$ zdump -v America/Sao_Paulo | awk '/Oct 16/ && /2016/'America/Sao_Paulo  Sun Oct 16 02:59:59 2016 UTC = Sat Oct 15 23:59:59 2016 BRT isdst=0America/Sao_Paulo  Sun Oct 16 03:00:00 2016 UTC = Sun Oct 16 01:00:00 2016 BRST isdst=1So any time between 00:00 to 00:59 on that day is considered invalid in your timezone (but maybe valid in others):$ TZ=America/Sao_Paulo gdate -d '2016-10-16 0:59'gdate: invalid date 2016-10-16 0:59$ TZ=Asia/Ho_Chi_Minh gdate -d '2016-10-16 0:59'Sun Oct 16 00:59:00 ICT 2016You can set additional time, which isn't in that range:$ TZ=America/Sao_Paulo gdate -d '2016-10-16 1:00'Sun Oct 16 01:00:00 BRST 2016The above is GNU date behavior.BSD date does not have this problem. If the input date is invalid in the timezone, it will be silently adjusted forwards 1 hour until it reaches a valid time:$ TZ=America/Sao_Paulo date -j -f '%Y%m%d%H%M' 201610160000Sun Oct 16 01:00:53 BRST 2016