1
Good afternoon I have the following doubt, I would like to print the date as follows for example 5/24/2019 but what this happens is the following
print(date)
Data: b'20290510113138Z'
I have the following code
cert =crypto.load_certificate(crypto.FILETYPE_PEM,open(cert_file).read())
date = cert.get_notAfter()
print("Data:",date)
found a code that solves the problem but do not know how to implement in my code any suggestion?
datetime.strtime(cert.get_notAfter().decode('ascii'), '%Y%m%d%H%M%SZ')
the date in bytes of your example is which? 10/5/2029? pq. if it is 24/5/2019, it is very difficult to kill the riddle -
– jsbueno
the date is 5/10/2029 but can also be 10/5/2029 has no problem
– Pedro Pinheiro
hmm.. MAY 10! why if it is OCTOBER 5, it has problem yes, as the most buggered protocol in history. (but the example you set extracts the month in the right order)
– jsbueno
in the next question, when placing examples of the data you have, and the desired output, please put the output that would result of those input data, not something completely disconnected. A date-time in bytes could be binary coded, and the conversion process would be completely different, for example.
– jsbueno