CakeFest 2025 Madrid: The Official CakePHP Conference

Voting

: min(six, three)?
(Example: nine)

The Note You're Voting On

Stilez
9 years ago
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

<< Back to user notes page

To Top