# |
Jan 1st 2020, 20:31 |
Rob73 |
if(!($fams_b->ark_date->isPast()) AND $fams_b->ark_date->isWithinNext('1 week')) |
# |
Jan 1st 2020, 20:31 |
ndm |
Alrighty, then `iasPast()` is fine :) |
# |
Jan 1st 2020, 20:30 |
Rob73 |
_now_ H:M:S |
# |
Jan 1st 2020, 20:29 |
ndm |
Just to make sure, you want to check whether it's before _now_, not before _the start of the current day_? |
# |
Jan 1st 2020, 20:27 |
Rob73 |
'$arker_d->ark_date->isPast()' this worked. I will look into it more and update my project. Thank you |
# |
Jan 1st 2020, 20:24 |
ndm |
https://book.cakephp.org/4/en/core-libraries/time.html#comparing-with-the-present |
# |
Jan 1st 2020, 20:23 |
ndm |
https://book.cakephp.org/chronos/1/en/index.html |
# |
Jan 1st 2020, 20:23 |
ndm |
The datetime objects that CakePHP uses offer all sorts of comparison methods, and they can be compared against each other using standard PHP comparison operators. Your check looks like you want to test for the past, ie whether `$arker_d->ark_date` is in the past: `$arker_d->ark_date->isPast()` |
# |
Jan 1st 2020, 20:21 |
Rob73 |
check if $today is bigger than $arker_d->ark_date |
# |
Jan 1st 2020, 20:20 |
Rob73 |
if it's bigger |
# |
Jan 1st 2020, 20:20 |
ndm |
So you want to check if a given date is today? |
# |
Jan 1st 2020, 20:20 |
Rob73 |
but it's breaking |
# |
Jan 1st 2020, 20:20 |
Rob73 |
it's rather simple |
# |
Jan 1st 2020, 20:19 |
Rob73 |
$today = date("Y-m-d\TH:i:sP"); |
# |
Jan 1st 2020, 20:19 |
ndm |
Well that's a different problem. What exactly does your comparison look like? |
# |
Jan 1st 2020, 20:16 |
Rob73 |
Sure it's the same date, but the format is different and therefore my php comparison return false when it should be true |
# |
Jan 1st 2020, 20:15 |
ndm |
That's both the same time, ie no timezone change. |
# |
Jan 1st 2020, 20:07 |
Rob73 |
I change the language using I18n::setLocale("zh_CH"); |
# |
Jan 1st 2020, 20:05 |
Rob73 |
Hello, is it possible to use I18n for multi-language site but not change timezone ? en_GB is 02/01/2020 20:00, when switching to zh_CH (China) it becomes this: 20/1/2 下午8:00 and it breaking my pages |
# |
Jan 1st 2020, 18:09 |
slackebot |
it was a database connection issue? |
# |
Jan 1st 2020, 18:09 |
kailas |
What’s the best/right way to handle intermittent, transient, errors while saving and test it? in a production system, in periods of increased database load, i’ve noticed that some of my saves seem to fail. my best guess at how to handle was to just keep trying to save up to n times, then quit. Also, how do you get the reason the save failed (if it wasn’t a validation error)? the return value from save is just null, right? how to know |
# |
Jan 1st 2020, 17:08 |
brandon |
@adamd Sorry for late reply - I deleted the lock file and got the same message. |
# |
Jan 1st 2020, 04:51 |
admad |
@luizcmarin https://github.com/UseMuffin/Orderly |
# |
Dec 31st 2019, 21:47 |
alexdd55976 |
Happy new year to everyone of this great cake community wherever you are on this planet. Thanks to all developers. Keep up this great work. |
# |
Dec 31st 2019, 20:35 |
luizcmarin |
thank you |
# |
Dec 31st 2019, 20:35 |
ricksaccous |
good luck |
# |
Dec 31st 2019, 20:35 |
ricksaccous |
something like that |
# |
Dec 31st 2019, 20:35 |
ricksaccous |
$this->Cidades->Paiss->find('nameOrder'); |
# |
Dec 31st 2019, 20:34 |
ricksaccous |
a custom finder would simply be |
# |
Dec 31st 2019, 20:34 |
ricksaccous |
that way you have it centralized |
# |
Dec 31st 2019, 20:34 |
ricksaccous |
whatever that table method is |
# |
Dec 31st 2019, 20:34 |
ricksaccous |
$paiss = $this->Cidades->tableMethod(); |
# |
Dec 31st 2019, 20:34 |
ricksaccous |
and from controller do |
# |
Dec 31st 2019, 20:34 |
ricksaccous |
you can do it in table |
# |
Dec 31st 2019, 20:27 |
luizcmarin |
I know it's a dumb question. So imagine where I got to ....:man-facepalming: |
# |
Dec 31st 2019, 20:27 |
luizcmarin |
in controller? |
# |
Dec 31st 2019, 20:26 |
luizcmarin |
$paiss = $this->Cidades->Paiss->find(_'list'_)->order([_'name'_ => _'ASC'_]); ? |
# |
Dec 31st 2019, 20:25 |
ricksaccous |
and put the order in the finder |
# |
Dec 31st 2019, 20:25 |
ricksaccous |
or you can create a finder |
# |
Dec 31st 2019, 20:25 |
ricksaccous |
ex StudentsTable extends Table { public function getStudents() { $this->find()->order(['Students.name' => 'ASC']); |
# |
Dec 31st 2019, 20:24 |
ricksaccous |
you can just create a query in the table class |