As already stated in the other answer, the -startdate and -enddate options are just display options.
The options to set the validity dates in the certificate generated by openssl x509 are
-not_before YYYYMMDDHHMMSSZ
-not_after YYYYMMDDHHMMSSZ
Link to the official docs: https://docs.openssl.org/master/man1/openssl-x509/