Change FrozenTime timezone in Cakephp3 Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How do I set the time zone of MySQL?Determine a user's timezoneBest way to handle storing/displaying dates in different timezones in PHP?Getting the client's timezone offset in JavaScriptCake PHP timezone wrongHow to store a datetime in MySQL with timezone infoChange time.Time timezone without reparsingCakePHP 3 form datetime input timezone saving to databaseLaravel change timezone for users according to preferencecheck if a date is valid in specific timezone mysqlSymfony - JMS Serializer - Convert a datetime to a specific timezone when serializing

Twin's vs. Twins'

Problem with display of presentation

My mentor says to set image to Fine instead of RAW — how is this different from JPG?

Short story about astronauts fertilizing soil with their own bodies

Found this skink in my tomato plant bucket. Is he trapped? Or could he leave if he wanted?

The test team as an enemy of development? And how can this be avoided?

What criticisms of Wittgenstein's philosophy of language have been offered?

Is the time—manner—place ordering of adverbials an oversimplification?

Statistical analysis applied to methods coming out of Machine Learning

How could a hydrazine and N2O4 cloud (or it's reactants) show up in weather radar?

How do I say "this must not happen"?

Flight departed from the gate 5 min before scheduled departure time. Refund options

Does a random sequence of vectors span a Hilbert space?

Vertical ranges of Column Plots in 12

New Order #6: Easter Egg

Is a copyright notice with a non-existent name be invalid?

Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?

Marquee sign letters

What does 丫 mean? 丫是什么意思?

How many time has Arya actually used Needle?

Derived column in a data extension

Why do C and C++ allow the expression (int) + 4*5;

Should man-made satellites feature an intelligent inverted "cow catcher"?

NIntegrate on a solution of a matrix ODE



Change FrozenTime timezone in Cakephp3



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How do I set the time zone of MySQL?Determine a user's timezoneBest way to handle storing/displaying dates in different timezones in PHP?Getting the client's timezone offset in JavaScriptCake PHP timezone wrongHow to store a datetime in MySQL with timezone infoChange time.Time timezone without reparsingCakePHP 3 form datetime input timezone saving to databaseLaravel change timezone for users according to preferencecheck if a date is valid in specific timezone mysqlSymfony - JMS Serializer - Convert a datetime to a specific timezone when serializing



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I have a script that daily do bulk import of log files to a "my_logs_db.logs" Table that will be queried by CakePHP3 app.
In the "logs" table I have a datetime field named 'date_time'. Imported Date for 'date_time' field refers to system timezone that is set to 'Europe/Paris' and not 'UTC'



What I want is to display date_time field with the application timezone, for example : 'Indian/Reunion' (UTC+4).



So I tried this :



I set timezone to SYSTEM for on the data source config/app.php. With this value MySQL should work with system time that is set to Europe/Paris:



'my_logs_db' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'user',
'password' => '*********',
'database' => 'my_logs_db',
'encoding' => 'utf8',
'timezone' => 'SYSTEM',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
'quoteIdentifiers' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_URL', null),
],


Somewhere in my Controller I set the timezone to use for display :



date_default_timezone_set('Indian/Reunion')


Somewhere in my Controller the SQL query is :



$logs = $this->Logs->find();
$logs->select([
'id',
'date_time',
'client_ip',
'domain',
]);


When I debug date_time, I get this :



object(CakeI18nFrozenTime) 

'time' => '2019-02-28T01:56:58+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false




And the displayed date is 2019-02-28 05:56:58 (UTC+4).



This is not the right time to display.



The date I want to display is 2019-02-28 04:56:58 (Europe/Paris+3)



So the output I want if I debug date_time must be like :



object(CakeI18nFrozenTime) 

'time' => '2019-02-28T01:56:58+00:00',
'timezone' => 'Europe/Paris',
'fixedNowTime' => false




The datetime I want should be unchanged and the timezone should be set to 'Europe/Paris'



For "FrozenTime" how to set timezone to 'Europe/Paris' and not 'UTC' ?
Or do I have to add something in my SQL query ?



Note that I don't want to change system timezone to UTC as work arround.










share|improve this question
























  • Did you pre-heat the oven or bake the cake? ... ha ha. Just having some fun with the Cake guys. Check you my.cnf file. if you use the Mysql functions NOW() ect. it has it's own timezone settings for that. See this stackoverflow.com/questions/930900/…

    – ArtisticPhoenix
    Mar 22 at 12:23












  • select NOW() give the date GMT+1 (so Europe/Paris). I have tried set time_zone = '+01:00';' change nothing FrozenTime timezone still UTC.

    – benoit974
    Mar 24 at 3:23











  • I found a work arround that consist to convert date into UTC : $logs->select(['date_time' => $dnslogs->func()->convert_tz(['date_time' => 'identifier','+01:00','+00:00'])]); But my question about FrozenTime still open.

    – benoit974
    Mar 24 at 5:15











  • CakePHP's datetime related database type classes do not yet support timezones for data read from the database, currently it's treated as being in the current PHP timezone. Support for this is going to be introduced in 4.x, see github.com/cakephp/cakephp/pull/13005. You could implemented this in a custom/extended database type if you need it now.

    – ndm
    Mar 24 at 16:24


















1















I have a script that daily do bulk import of log files to a "my_logs_db.logs" Table that will be queried by CakePHP3 app.
In the "logs" table I have a datetime field named 'date_time'. Imported Date for 'date_time' field refers to system timezone that is set to 'Europe/Paris' and not 'UTC'



What I want is to display date_time field with the application timezone, for example : 'Indian/Reunion' (UTC+4).



So I tried this :



I set timezone to SYSTEM for on the data source config/app.php. With this value MySQL should work with system time that is set to Europe/Paris:



'my_logs_db' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'user',
'password' => '*********',
'database' => 'my_logs_db',
'encoding' => 'utf8',
'timezone' => 'SYSTEM',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
'quoteIdentifiers' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_URL', null),
],


Somewhere in my Controller I set the timezone to use for display :



date_default_timezone_set('Indian/Reunion')


Somewhere in my Controller the SQL query is :



$logs = $this->Logs->find();
$logs->select([
'id',
'date_time',
'client_ip',
'domain',
]);


When I debug date_time, I get this :



object(CakeI18nFrozenTime) 

'time' => '2019-02-28T01:56:58+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false




And the displayed date is 2019-02-28 05:56:58 (UTC+4).



This is not the right time to display.



The date I want to display is 2019-02-28 04:56:58 (Europe/Paris+3)



So the output I want if I debug date_time must be like :



object(CakeI18nFrozenTime) 

'time' => '2019-02-28T01:56:58+00:00',
'timezone' => 'Europe/Paris',
'fixedNowTime' => false




The datetime I want should be unchanged and the timezone should be set to 'Europe/Paris'



For "FrozenTime" how to set timezone to 'Europe/Paris' and not 'UTC' ?
Or do I have to add something in my SQL query ?



Note that I don't want to change system timezone to UTC as work arround.










share|improve this question
























  • Did you pre-heat the oven or bake the cake? ... ha ha. Just having some fun with the Cake guys. Check you my.cnf file. if you use the Mysql functions NOW() ect. it has it's own timezone settings for that. See this stackoverflow.com/questions/930900/…

    – ArtisticPhoenix
    Mar 22 at 12:23












  • select NOW() give the date GMT+1 (so Europe/Paris). I have tried set time_zone = '+01:00';' change nothing FrozenTime timezone still UTC.

    – benoit974
    Mar 24 at 3:23











  • I found a work arround that consist to convert date into UTC : $logs->select(['date_time' => $dnslogs->func()->convert_tz(['date_time' => 'identifier','+01:00','+00:00'])]); But my question about FrozenTime still open.

    – benoit974
    Mar 24 at 5:15











  • CakePHP's datetime related database type classes do not yet support timezones for data read from the database, currently it's treated as being in the current PHP timezone. Support for this is going to be introduced in 4.x, see github.com/cakephp/cakephp/pull/13005. You could implemented this in a custom/extended database type if you need it now.

    – ndm
    Mar 24 at 16:24














1












1








1








I have a script that daily do bulk import of log files to a "my_logs_db.logs" Table that will be queried by CakePHP3 app.
In the "logs" table I have a datetime field named 'date_time'. Imported Date for 'date_time' field refers to system timezone that is set to 'Europe/Paris' and not 'UTC'



What I want is to display date_time field with the application timezone, for example : 'Indian/Reunion' (UTC+4).



So I tried this :



I set timezone to SYSTEM for on the data source config/app.php. With this value MySQL should work with system time that is set to Europe/Paris:



'my_logs_db' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'user',
'password' => '*********',
'database' => 'my_logs_db',
'encoding' => 'utf8',
'timezone' => 'SYSTEM',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
'quoteIdentifiers' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_URL', null),
],


Somewhere in my Controller I set the timezone to use for display :



date_default_timezone_set('Indian/Reunion')


Somewhere in my Controller the SQL query is :



$logs = $this->Logs->find();
$logs->select([
'id',
'date_time',
'client_ip',
'domain',
]);


When I debug date_time, I get this :



object(CakeI18nFrozenTime) 

'time' => '2019-02-28T01:56:58+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false




And the displayed date is 2019-02-28 05:56:58 (UTC+4).



This is not the right time to display.



The date I want to display is 2019-02-28 04:56:58 (Europe/Paris+3)



So the output I want if I debug date_time must be like :



object(CakeI18nFrozenTime) 

'time' => '2019-02-28T01:56:58+00:00',
'timezone' => 'Europe/Paris',
'fixedNowTime' => false




The datetime I want should be unchanged and the timezone should be set to 'Europe/Paris'



For "FrozenTime" how to set timezone to 'Europe/Paris' and not 'UTC' ?
Or do I have to add something in my SQL query ?



Note that I don't want to change system timezone to UTC as work arround.










share|improve this question
















I have a script that daily do bulk import of log files to a "my_logs_db.logs" Table that will be queried by CakePHP3 app.
In the "logs" table I have a datetime field named 'date_time'. Imported Date for 'date_time' field refers to system timezone that is set to 'Europe/Paris' and not 'UTC'



What I want is to display date_time field with the application timezone, for example : 'Indian/Reunion' (UTC+4).



So I tried this :



I set timezone to SYSTEM for on the data source config/app.php. With this value MySQL should work with system time that is set to Europe/Paris:



'my_logs_db' => [
'className' => 'CakeDatabaseConnection',
'driver' => 'CakeDatabaseDriverMysql',
'persistent' => false,
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'user',
'password' => '*********',
'database' => 'my_logs_db',
'encoding' => 'utf8',
'timezone' => 'SYSTEM',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
'quoteIdentifiers' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_URL', null),
],


Somewhere in my Controller I set the timezone to use for display :



date_default_timezone_set('Indian/Reunion')


Somewhere in my Controller the SQL query is :



$logs = $this->Logs->find();
$logs->select([
'id',
'date_time',
'client_ip',
'domain',
]);


When I debug date_time, I get this :



object(CakeI18nFrozenTime) 

'time' => '2019-02-28T01:56:58+00:00',
'timezone' => 'UTC',
'fixedNowTime' => false




And the displayed date is 2019-02-28 05:56:58 (UTC+4).



This is not the right time to display.



The date I want to display is 2019-02-28 04:56:58 (Europe/Paris+3)



So the output I want if I debug date_time must be like :



object(CakeI18nFrozenTime) 

'time' => '2019-02-28T01:56:58+00:00',
'timezone' => 'Europe/Paris',
'fixedNowTime' => false




The datetime I want should be unchanged and the timezone should be set to 'Europe/Paris'



For "FrozenTime" how to set timezone to 'Europe/Paris' and not 'UTC' ?
Or do I have to add something in my SQL query ?



Note that I don't want to change system timezone to UTC as work arround.







php mysql cakephp timezone cakephp-3.0






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 12:48









Siva

1,13211222




1,13211222










asked Mar 22 at 12:17









benoit974benoit974

156




156












  • Did you pre-heat the oven or bake the cake? ... ha ha. Just having some fun with the Cake guys. Check you my.cnf file. if you use the Mysql functions NOW() ect. it has it's own timezone settings for that. See this stackoverflow.com/questions/930900/…

    – ArtisticPhoenix
    Mar 22 at 12:23












  • select NOW() give the date GMT+1 (so Europe/Paris). I have tried set time_zone = '+01:00';' change nothing FrozenTime timezone still UTC.

    – benoit974
    Mar 24 at 3:23











  • I found a work arround that consist to convert date into UTC : $logs->select(['date_time' => $dnslogs->func()->convert_tz(['date_time' => 'identifier','+01:00','+00:00'])]); But my question about FrozenTime still open.

    – benoit974
    Mar 24 at 5:15











  • CakePHP's datetime related database type classes do not yet support timezones for data read from the database, currently it's treated as being in the current PHP timezone. Support for this is going to be introduced in 4.x, see github.com/cakephp/cakephp/pull/13005. You could implemented this in a custom/extended database type if you need it now.

    – ndm
    Mar 24 at 16:24


















  • Did you pre-heat the oven or bake the cake? ... ha ha. Just having some fun with the Cake guys. Check you my.cnf file. if you use the Mysql functions NOW() ect. it has it's own timezone settings for that. See this stackoverflow.com/questions/930900/…

    – ArtisticPhoenix
    Mar 22 at 12:23












  • select NOW() give the date GMT+1 (so Europe/Paris). I have tried set time_zone = '+01:00';' change nothing FrozenTime timezone still UTC.

    – benoit974
    Mar 24 at 3:23











  • I found a work arround that consist to convert date into UTC : $logs->select(['date_time' => $dnslogs->func()->convert_tz(['date_time' => 'identifier','+01:00','+00:00'])]); But my question about FrozenTime still open.

    – benoit974
    Mar 24 at 5:15











  • CakePHP's datetime related database type classes do not yet support timezones for data read from the database, currently it's treated as being in the current PHP timezone. Support for this is going to be introduced in 4.x, see github.com/cakephp/cakephp/pull/13005. You could implemented this in a custom/extended database type if you need it now.

    – ndm
    Mar 24 at 16:24

















Did you pre-heat the oven or bake the cake? ... ha ha. Just having some fun with the Cake guys. Check you my.cnf file. if you use the Mysql functions NOW() ect. it has it's own timezone settings for that. See this stackoverflow.com/questions/930900/…

– ArtisticPhoenix
Mar 22 at 12:23






Did you pre-heat the oven or bake the cake? ... ha ha. Just having some fun with the Cake guys. Check you my.cnf file. if you use the Mysql functions NOW() ect. it has it's own timezone settings for that. See this stackoverflow.com/questions/930900/…

– ArtisticPhoenix
Mar 22 at 12:23














select NOW() give the date GMT+1 (so Europe/Paris). I have tried set time_zone = '+01:00';' change nothing FrozenTime timezone still UTC.

– benoit974
Mar 24 at 3:23





select NOW() give the date GMT+1 (so Europe/Paris). I have tried set time_zone = '+01:00';' change nothing FrozenTime timezone still UTC.

– benoit974
Mar 24 at 3:23













I found a work arround that consist to convert date into UTC : $logs->select(['date_time' => $dnslogs->func()->convert_tz(['date_time' => 'identifier','+01:00','+00:00'])]); But my question about FrozenTime still open.

– benoit974
Mar 24 at 5:15





I found a work arround that consist to convert date into UTC : $logs->select(['date_time' => $dnslogs->func()->convert_tz(['date_time' => 'identifier','+01:00','+00:00'])]); But my question about FrozenTime still open.

– benoit974
Mar 24 at 5:15













CakePHP's datetime related database type classes do not yet support timezones for data read from the database, currently it's treated as being in the current PHP timezone. Support for this is going to be introduced in 4.x, see github.com/cakephp/cakephp/pull/13005. You could implemented this in a custom/extended database type if you need it now.

– ndm
Mar 24 at 16:24






CakePHP's datetime related database type classes do not yet support timezones for data read from the database, currently it's treated as being in the current PHP timezone. Support for this is going to be introduced in 4.x, see github.com/cakephp/cakephp/pull/13005. You could implemented this in a custom/extended database type if you need it now.

– ndm
Mar 24 at 16:24













0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55299430%2fchange-frozentime-timezone-in-cakephp3%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55299430%2fchange-frozentime-timezone-in-cakephp3%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript