Fixing bug in cron script (invalid date format)