openssl s_client -connect host:port | openssl x509 -enddate -noout
e.g. the command
openssl s_client -connect imap.gmail.com:993 | openssl x509 -enddate -noout
returns:
depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
verify return:0
notAfter=Nov 24 13:45:00 2016 GMT