1

Mysql TimeZone - Asia/kolkata
PHP TimeZone - Asia/Kolkata
Magento 2 Config - Asia/Kolkata

lets say I have following two rows in sales_order:

enter image description here

I have Following Query:

select count(*) from sales_order where date(created_at) = date('2019-04-28');

Result in Mysql WorkBench: 2
Result in Magento 2 Resource Model Class: 1

I used

$this->connection->fetchAll("select count(*) from sales_order where date(created_at) = date('2019-04-28')");

for fetching data in Resource Model.

I know this created_at is getting converted to UTC. I want my query results to be in Asia/Kolkata time zone. Any help would be appreciated.

Some things i already tried:

  1. Changing TimeZone in bootstrap.php from UTC to required timezone.
  2. setting PHP TimeZone just before executing my query.

I can fix this by running a loop on result set, but i want my query to do all the work.

Ajay
  • 458
  • 4
  • 20

0 Answers0