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

chadchandler’s picture

Anyone? Please?

karens’s picture

Status: Active » Fixed

Add a date filter, set the operator to >=, leave the date blank and set the option to 'now'.

chadchandler’s picture

Use Full date? or day? Thanks btw!

karens’s picture

The full date, day would look for matching days in any month and year.

ibexy’s picture

This did not work for me. I need to display nodes published TODAY. Any more help please.

ibexy’s picture

set value to now and put the number -86400 in the options. That worked for me. Found the solution here:

http://drupal.org/node/184998

chadchandler’s picture

So 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.

karens’s picture

Title: View all nodes that have a CCK Date that is equal to or greater than Today. » Clarity about what 'now' means
Status: Fixed » Active

I 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?

chadchandler’s picture

I 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.

seutje’s picture

I 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...

arlinsandbulte’s picture

Status: Active » Fixed

At 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Aquabert’s picture

Version: 5.x-2.x-dev » 6.x-2.4

"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.

Exploratus’s picture

I am having same problem. When I list dates in node view, it doesnt show todays date for some reason.