Convert 6 digit number to date

I’m integrating external API which has expire_in key with value 179999. I need to convert the value to date so that I can compare current date with expired date (expired_in). from the API documentation say it expired in 50 Hour. I know that i can just create manually like strtotime('+50 hour') but still I want to know how can I convert 179999 to date.

what I try

DateTime::createFromFormat('ymd', 179999)->format('Y-m-d')

but it give me this result 2025-06-07


To add 179999 seconds to the current date:

$now = new DateTime();
$now->add(new DateInterval('PT179999S')); // adds 179999 secs
echo $now->format('Y-m-d H:i:s');

Leave a Reply

Your email address will not be published. Required fields are marked *