As in subject. Cake version 3.1, Carbon.
For example you can see it with:
$time = Time::now();
debug($time);
As in subject. Cake version 3.1, Carbon.
For example you can see it with:
$time = Time::now();
debug($time);
Did you open the code? The code will show it exactly.
No. Code of what, Cake Time, php Carbon or php date/datetime? Can you give me some links?
But I tried to search in book 3 and just in google. Most results are from people pasting debug dump and are not related.
And if you know how it work or what is for, can you say me in one sentence?
Because you can disassemble or reverse any program, but it is not most efficient way to know how it should work.
It is actually the single most efficient way Learn your basics and you will excel.
As for your code:
And a very quick search would have found you that within seconds, way quicker than any forum or chat can help you with.
Also, when then following this line, the docblock even says exactly to the very detail what this stands for:
/**
* Determine if there is a valid test instance set. A valid test instance
* is anything that is not null.
*
* @return bool True if there is a test instance, otherwise false
*/
public static function hasTestNow(): bool
it is mainly for test-mode. Try this code (using Cakephp 4)
$time = new FrozenTime('2021-01-31 22:11:30', 'America/New_York');
FrozenTime::setTestNow($time);
debug($time);
This would output
object(Cake\I18n\FrozenTime) id:0 {
'time' => '2021-01-31 22:11:30.000000-05:00'
'timezone' => 'America/New_York'
'fixedNowTime' => '2021-01-31T22:11:30.000000-05:00'
}
Further down in your code, if you create a time object with now
// Calling "now" will show the test-time
$now = FrozenTime::now();
debug($now->i18nFormat('yyyy-MM-dd HH:mm:ss'));
// Outputs : '2021-02-01 11:11:30'
Thanks, I tried some test and in 3.1 FrozenTime simple doesn’t work it seems it is Chronos part, but for some reason I can see this ‘fixedNowTime’ in debug from 3.1.
I tried it in 3.6 (I don’t have / use 4.x) and first example go well, third doesn’t work, I get error at $now = FrozenTime::now();
@dereuromark can you please tell me your method of finding this? I can grep through the vendor folder on my disk, but maybe there is a better way? Also I check your link to github, and try to find this comment about hasTestNow()
hit ctrl+f → no declaration.
Then I double clicked it, github opens some search on right, show only this file, after click “search for this symbol” nothing new was found.
Also watching this site, how can I check what am I watching? Which version? In case of API documentation there is simple select with 3.1 3.2 3.3 etc, and here?
Anyway I will keep ignore it as I was doing for couple years.