Closed (fixed)
Project:
Date
Version:
6.x-2.4
Component:
Date CCK Field
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Aug 2008 at 22:42 UTC
Updated:
3 Dec 2010 at 13:39 UTC
PHP Version 5.2
Drupal 5.9
Date & not datestamp
No Time Zone Conversion
Objective: Confirming the correct code to view all nodes that have a CCK Date that is either today or later.
We know the operator needs to be greater than or equal too , but "today" is not a valid value is it?
It is of dire importance on our site to achieve this functionality. (even considered unpublishing all nodes w/ a cck date less than today, and using the "published filter" instead.)
So, if today is August 8th 2008 ... how can we show all nodes that have a CCK Date of today (Aug8th) or later?
Thank you so much for your time in advance. Greatly appreciated.
Comments
Comment #1
chadchandler commentedAnyone? Please?
Comment #2
karens commentedAdd a date filter, set the operator to >=, leave the date blank and set the option to 'now'.
Comment #3
chadchandler commentedUse Full date? or day? Thanks btw!
Comment #4
karens commentedThe full date, day would look for matching days in any month and year.
Comment #5
ibexy commentedThis did not work for me. I need to display nodes published TODAY. Any more help please.
Comment #6
ibexy commentedset value to now and put the number -86400 in the options. That worked for me. Found the solution here:
http://drupal.org/node/184998
Comment #7
chadchandler commentedSo under this logic, if you wanted to display nodes that have a cck date of today or later .... you wouldn't use >= now... but you should use >= now-86400 .
Is the conclusion here that "now" is actually the end of the day? Or is this not the case in the latest release? you must admit... somewhat confusing.
Comment #8
karens commentedI tried doing things like the beginning or end of the day and that creates other problems if that's not what you want, and to tell you the truth I'm not sure exactly which way it ended up, so I guess we need to discuss. Whatever we do, it has to be flexible enough to work no matter what you're looking for, so it probably has to use granularity somehow -- is 'now' the beginning of the day, the beginning of the hour, right this minute?
Comment #9
chadchandler commentedI can't think of a use-case scenario where "now" would be needed in second, minute or even hour. Will there be 1-2 people that straggle in and need this .. well of course but the majority of users using this fantastic module would probably be fine with the day.
Or, you could just at "today" as an option? Hypothesizing the exact definition would be anecdotal for me to do, as I haven't work w/ this modules code.
Comment #10
seutje commentedI always figured this option just used the php strotime() function
but if that was the case "today" would be midnight today which is often not preferable , so maybe "this 6am" would be more interesting for some ppl
after some testing, I concluded that "now" is right now, down to the minute (if not second), "now -86400" doesn't even work at all and "now -86400 seconds" pretty much returns the same as "now -1 day"
I've also tried "now 7am" but that didn't rly work, nor did "now 07:00" or "now 0700"
but I suppose if u set the granulary of the date field to days and not hours or minutes, "greater than or equal to 'now'" should return everything with date field today from 0:00 to 23:00, but I haven't tested that yet
maybe it'd be better to just have it being parsed by strotime(), even though that would cause inconsistencies between different PHP versions...
Comment #11
arlinsandbulte commentedAt least in 6.x-2.x:
I confirmed that changing the granularity settings of your view filter change how the filter uses "now".
If you set the granularity to "Day" and use "now" in your filter, all posts for the current day are displayed.
If granularity is "Hour", all posts for the current hour are displayed.
The same applies for all granularity settings, year, minute, second (although minute and second seem a little too fine in most cases).
I am assuming this is similar in the 5.x-2.x versions, which is the version in question in this thread.
I'll mark this as fixed now. If anyone needs more clarification, open it back up and ask away.
Comment #13
Aquabert commented"Now" doesnt work for me.
I have a node-type with multiple date fields and want the node to show only the dates for today and in the future.
Below the "display fields" tab, I set the "starting form" field to "now". But it doesn't show the date for today. It starts from tomorrow.
Comment #14
Exploratus commentedI am having same problem. When I list dates in node view, it doesnt show todays date for some reason.