How to get Admin session lifetime value in Magento 2?

Retrieve the admin session lifetime value in Magento 2 using Programmatic way with ConfigInterface.

From Admin Panel, You can get the value from Stores -> Configuration -> Admin -> Security -> Admin Session Lifetime (seconds).

In this field you can set at least value is 60 and at most 31536000 equal to one year. You can set the custom value as per your requirement between the above range.

<?php
namespace Jesadiya\AdminSessionLifetime\Model;

use Magento\Backend\App\ConfigInterface;

class AdminSessionLifetime
{
    /**
     * Admin session lifetime XML path
     */
    const XML_PATH_SESSION_LIFETIME = 'admin/security/session_lifetime';

    /**
     * @var ConfigInterface
     */
    private $config;

    public function __construct(
        ConfigInterface $config
    ) {
        $this->config = $config;
    }

    /**
     * @return mixed
     */
    public function getSessionLifetime()
    {
        return $this->config->getValue(self::XML_PATH_SESSION_LIFETIME);
    }
}