Model/ResourceModel/Contact.php
public function getDateLastCronRun($cronJob)
    {
        $collection = $this->schelduleFactory->create()
            ->getCollection()
            ->addFieldToFilter('status', \Magento\Cron\Model\Schedule::STATUS_SUCCESS)
            ->addFieldToFilter('job_code', $cronJob);
        //limit and order the results
        $collection->getSelect()
            ->limit(1)
            ->order('executed_at DESC');

        if ($collection->getSize() == 0) {
            return false;
        }
        $executedAt = $collection->getFirstItem()->getExecutedAt();

        return $executedAt;
    }
public function getDateLastCronRun($cronJob)
    {
        $collection = $this->schelduleFactory->create()
            ->getCollection()
            ->addFieldToFilter('status', \Magento\Cron\Model\Schedule::STATUS_SUCCESS)
            ->addFieldToFilter('job_code', $cronJob);
        //limit and order the results
        $collection->getSelect()
            ->limit(1)
            ->order('executed_at DESC');

        if ($collection->getSize() == 0) {
            return false;
        }
        $executedAt = $collection->getFirstItem()->getExecutedAt();

        return $executedAt;
    }
public function getDateLastCronRun ( $ cronJob ) { $ collection = $ this -> schelduleFactory -> create ( ) -> getCollection ( ) -> addFieldToFilter ( 'status' , \ Magento \ Cron \ Model \ Schedule :: STATUS_SUCCESS ) -> addFieldToFilter ( 'job_code' , $ cronJob ) ; //limit and order the results $ collection -> getSelect ( ) -> limit ( 1 ) -> order ( 'executed_at DESC' ) ; if ( $ collection -> getSize ( ) == 0 ) { return false ; } $ executedAt = $ collection -> getFirstItem ( ) -> getExecutedAt ( ) ; return $ executedAt ; }
Get last cron ran date.

@param string $cronJob

@return boolean|string
Get last cron ran date .