# KReporter - Wrong data displayed correctly

**URL:** <https://community.spicecrm.io/t/kreporter-wrong-data-displayed-correctly/271>\
**Category:** KReporter\
**Created:** [March 11, 2018, 5:53pm UTC](https://community.spicecrm.io/t/kreporter-wrong-data-displayed-correctly/271 "2018-03-11T17:53:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rolando](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@rolando](https://community.spicecrm.io/u/rolando)\
**Post date:** [March 11, 2018, 5:53pm UTC](https://community.spicecrm.io/t/kreporter-wrong-data-displayed-correctly/271/1 "2018-03-11T17:53:56Z")

</div>

I’m running a KReport on the Leads table, my user has the timezone set to America/New\_York, when I select Leads where “Date Created” is between 2018-01-10 and 2018-01-11, the returned data is Leads where “Date Created” is between 2018-01-10 and 2018-01-11 **UTC time** , not America/New\_York; however data is displayed with the expected timezone (America/New\_York).

I’m using KReport 3.0 on SuiteCRM Version 7.4.1 (Sugar Version 6.5.20)

---

<div class="post-metadata">

**Author:** ![maretval](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@maretval](https://community.spicecrm.io/u/maretval)\
**Post date:** [March 13, 2018, 10:44pm UTC](https://community.spicecrm.io/t/kreporter-wrong-data-displayed-correctly/271/2 "2018-03-13T22:44:35Z")

</div>

Rolando,  
handling of timezone in select was introduced in KReporter 4.  
Doing a Kreporter Update shall solve the problem. Migrating from KReporter 3 requires a bit work.  
Before you update, you may try to add following code snippet in file modules/KReports/KReportQuery.php line 148 (line number as in KReporter 3.1, i don’t have 3.0 anymore)

// do time handling treating passed in values as User Timezone converting to UTS  
if($whereArrayEntry[‘type’] == ‘datetime’){  
$userTimezZone = $GLOBALS[‘current\_user’]-\>getPreference(‘timezone’);  
if($whereArrayEntry[‘valuekey’] != ‘’){  
$valuefromdate = SugarDateTime::createFromFormat(‘Y-m-d H:i:s’, $whereArrayEntry[‘valuekey’], new DateTimeZone($userTimezZone));  
$valuefromdate-\>setTimezone(new DateTimeZone(‘UTC’));  
$this-\>whereArray[$whereId][‘valuekey’] = $valuefromdate-\>format(‘Y-m-d H:i:s’);  
$this-\>whereArray[$whereId][‘value’] = $valuefromdate-\>format(‘Y-m-d H:i:s’);  
}  
if($whereArrayEntry[‘valuetokey’] != ‘’){  
$valuetodate = SugarDateTime::createFromFormat(‘Y-m-d H:i:s’, $whereArrayEntry[‘valuetokey’], new DateTimeZone($userTimezZone));  
$valuetodate-\>setTimezone(new DateTimeZone(‘UTC’));  
$this-\>whereArray[$whereId][‘valuetokey’] = $valuetodate-\>format(‘Y-m-d H:i:s’);  
$this-\>whereArray[$whereId][‘valueto’] = $valuetodate-\>format(‘Y-m-d H:i:s’);  
}  
}

Insert in

 ![KReportQuery01](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/dd2e6c9f9b8a7f61d769ce2ad49e807fe2449efc.png)

Val
