문제

I've parsed openssl certificate by openssl_x509_parse() function and got an array as a result.

Now I need to get the expiration time of that certificate. In parsed array I have validTo_time_t element which contains a valid unix timestamp. But how to determine what timezone this timestamp belongs for?

So I can't get the real expiration time because that timestamp because it means deifferent dates on different timezones.

도움이 되었습니까?

해결책 2

php formats this field using it's default timezone. you can get it using http://docs.php.net/date_default_timezone_get function

and once you know the timezone you can convert it to UTC or whatever you need

다른 팁

Unix TimeStamp have no timezone. It's defined as number of seconds since January 1st, 1970 at UTC. It's not a defined as a real date but just a bunch of seconds. No timezone = no problems.

This is why it's a perfect measure of time across different server and different regions. You can just store unix timestamp, and when you convert it to a date it will use your local timezone to determinate the date, this is completly automatic and this means that when you convert givin a different timezone it will convert to the correct date. Always.

This is true for all timestamp not just for the SSL output. Major info on Timestamp http://www.unixtimestamp.com/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top