I have tried different options but i am not getting the current time, time shows the gmt time, but actual time setting is asia/kolkatta, any one done this, please update the answer.
protected $datetime;
public function __construct(Context $context,
ObjectManagerInterface $objectManager,
StoreManagerInterface $storeManager,
\Magento\Framework\Stdlib\DateTime\DateTime $datetime
) {
$this->objectManager = $objectManager;
$this->storeManager = $storeManager;
$this->datetime = $datetime;
parent::__construct($context);
}
$current_time = $this->datetime->gmtDate();// this will return only gmt time
Not the time i have set in the admin configuration locale timezone.