Yes, but as I have said,
You need to check that the entered date is in the correct format, within a valid range, and is a valid date (not 56th Febtember). My script does that.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.