Timeline for How add a function in a condition method in db api
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 31, 2017 at 11:49 | vote | accept | ShanjayG | ||
May 23, 2017 at 17:50 | comment | added | rjl | Let us continue this discussion in chat. | |
May 23, 2017 at 17:47 | comment | added | rjl |
Sorry got interupted try changing strtotime(04/05/2017) to strtotime('04/05/2017') Also I think just strtotime('04/05/2017') will give you the same result as your $start_date formula and for $end_date doing something like strtotime('04/05/2017') + ($hours * 60 * 60) where $hours is how many hours since 00:00 - it might be cleaner and easier to read.
|
|
May 23, 2017 at 17:44 | comment | added | ShanjayG |
Thanks for until now, the dates are dynamic, I pasted the date directly for ease of reading. the date passed at strtotime is like this strtotime($from_date) , and $from_date is being passed as a string in yyyy-mm-dd format.
|
|
May 23, 2017 at 17:37 | comment | added | rjl | If you copied that correctly you are getting wrong dates, because you didn't quote the dates so it's evaluation 4 / 5 / 2007 as a math statement. | |
May 23, 2017 at 17:14 | comment | added | ShanjayG |
I did, this somehow is not working, although it could be because of the format of $start_date and $end_date . they are generated like this $start_date = strtotime(date('Y-m-d 00:00:00', strtotime(04/05/2017))); $end_date = strtotime(date('Y-m-d 00:00:00', strtotime(10/05/2017))); while the field_symposium_event_time_value is in 2017-05-05 17:30:00 format.
|
|
May 23, 2017 at 17:05 | comment | added | rjl | Did you see the updated answer? | |
May 23, 2017 at 17:01 | history | edited | rjl | CC BY-SA 3.0 |
on further research, it is the ->where() function that should be used.
|
May 23, 2017 at 17:00 | comment | added | ShanjayG | Yea I upvoted too early. This doesn't work on another conditions, would you know to use where.?? | |
May 23, 2017 at 16:57 | comment | added | rjl | Thanks for the up-vote, but I am wondering if that actually worked. I suddenly realized that addExpression() is for the SELECT cause, and you can use where() for WHERE clause expressions. api.drupal.org/api/drupal/… I will update the answer | |
May 23, 2017 at 16:45 | vote | accept | ShanjayG | ||
May 23, 2017 at 16:59 | |||||
May 23, 2017 at 16:45 | comment | added | ShanjayG | Thank you exactly what I needed. I still dont understand the concept of addExpression. | |
May 23, 2017 at 16:38 | history | answered | rjl | CC BY-SA 3.0 |