I want to see the session expires time in a readable format. The time is stored as an int. Is there a way to see it in a readable format? I couldn't find how Magento is deriving the int.

I tried the following query, which gave me a readable time, but the values didn't seem right.

select session_id, FROM_UNIXTIME(session_expires) as time from core_session ORDER BY time asc limit 20;

I tried ordering by both asc and desc, but neither gave values that seemed right. Is there another way?


From line ~239 of


you get

'session_expires' => Varien_Date::toTimestamp(true) + $this->getLifeTime(),


 * Retrieve session life time
 * @return int
public function getLifeTime()
    if (is_null($this->_lifeTime)) {
        $configNode = Mage::app()->getStore()->isAdmin() ?
                'admin/security/session_cookie_lifetime' : 'web/cookie/cookie_lifetime';
        $this->_lifeTime = (int) Mage::getStoreConfig($configNode);

        if ($this->_lifeTime < 60) {
            $this->_lifeTime = ini_get('session.gc_maxlifetime');

        if ($this->_lifeTime < 60) {
            $this->_lifeTime = 3600; //one hour

        if ($this->_lifeTime > self::SEESION_MAX_COOKIE_LIFETIME) {
            $this->_lifeTime = self::SEESION_MAX_COOKIE_LIFETIME; // 100 years
    return $this->_lifeTime;

sets time in seconds. It means the value of the saved fields is composed by i.e a timestamp plus 3600 seconds. You should be able to decode the timestamp with this to see the actual date of expiration in a human format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.