note 119438 added to function.openssl-x509-parse
| From: | Stilez | Date: | Mon, 06 Jun 2016 04:12:49 +0000 |
| Subject: | note 119438 added to function.openssl-x509-parse | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205668@lists.php.net to get a copy of this message | ||
The valid from/to info is returned twice, in two different formats. They can be converted to normal
datetime objects like this:
$x509_data = openssl_x509_parse($cert);
date_create_from_format('ymdHise',
$x509_data['validFrom'])->format('c');
date_create( '@' . $x509_data['validFrom_time_t'])->format('c');
/* these give the same result */
To get a human-readable format directly (or any other formatted string) instead of a datetime
object, use this:
date_create_from_format('ymdHise',
$x509_data['validFrom'])->format('c');
or
date_create( '@' . $x509_data['validFrom_time_t'])->format('c');
The same applies to validTo and validTo_time_t
----
Server IP: 72.52.91.14
Probable Submitter: 78.32.235.97
----
Manual Page -- http://php.net/manual/en/function.openssl-x509-parse.php
Edit -- https://master.php.net/note/edit/119438
Del: integrated -- https://master.php.net/note/delete/119438/integrated
Del: useless -- https://master.php.net/note/delete/119438/useless
Del: bad code -- https://master.php.net/note/delete/119438/bad+code
Del: spam -- https://master.php.net/note/delete/119438/spam
Del: non-english -- https://master.php.net/note/delete/119438/non-english
Del: in docs -- https://master.php.net/note/delete/119438/in+docs
Del: other reasons-- https://master.php.net/note/delete/119438
Reject -- https://master.php.net/note/reject/119438
Search -- https://master.php.net/manage/user-notes.php