How to check ssl certificate expiry date using openssl command?

hi

how to check ssl certificate expiry date using openssl command
try below code it is not working, any help

echo q | openssl s_client -connect akamai.com:443 | openssl x509 -noout -enddate
socket: Bad file descriptor
connect:errno=9
unable to load certificate
140587484587920:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:707:Expecting: TRUSTED CERTIFICATE