How to convert ZF2 Doctrine createQueryBuilder date field to timezone

This is my query :

$casesData = $this->getEntityManager()->getRepository('Cases\Entity\Cases')
    ->createQueryBuilder('cases')
    ->select('cases.CaseId',
        'cases.CreatedDate',
        'cases.LeadId',
        'cases.InquiryID',
        'cases.FirstName',
        'cases.LastName',
        'cases.CityDoc1',
        'cases.StateDoc1',
        'cases.SSN',
        'cases.Status',
        'cases.CaseManagerId',
        'users.first_name'
);

cases.CreatedDate is currently have "US Canada" timezone, now I want to convert base on timezone dropdown value, and I can't found any solution to convert timezone as per above query, please help me.

Answers


Actually with query builder you can't change the time zone, you have to use loop as doctrine return datetime object than you can modify the time as you wish

foreach($data as item){
   $date = $item['CreatedDate']->modify('....')
}

Need Your Help

Creating a streamgraph in R

r data-visualization stream-graph

I would like to visualize my data frame which contains 5 numeric values that change over time. I would like to visualize it using a streamgraph, but I don't seem to be doing it the right way.

Simultaneous NSDate generation leading to different time intervals

ios objective-c bluetooth nsdate gamekit

In a server-client game using bluetooth connectivity (GameKit, specifically, for iOS6 compatibility), 1 or more client devices (iPhone/iTouch) send a timestamp to the server device (iPad) when a bu...