PHP Datetime object outputs trailing zeroes, affects query against MySQL datetime -


the following expression

$datetime = new \datetime('2016-06-02 19:30:17', new \datetimezone('america/tijuana')); $datetime->settimezone(new \datetimezone('gmt')); 

is returning 2016-06-03 02:30:17.000000 (note outputting 0's not present in input).

so in yii2's query building, query against db datetime column following, cannot made because of trailing 0's.

->andfilterwhere(['created_at' => $this->datetime->format('php:y-m-d h:i:s')]); 

why datetime object outputting 0's in first place?

i suppose comparison between or operands >= might do, thoughts?

those microseconds generated default default format y-m-d h:i:s.u. can override specifying y-m-d h:i:s if that's want.