This is a simple question. I'm setting up a View that shows only content that has been posted on the current date. In the Post Date filter, I have the option:

A date in any machine readable format. CCYY-MM-DD HH:MM:SS is preferred.

What value do I enter to signify the current date?

Thanks.

Comments

nevets’s picture

If you mean the default value use the relative value today

i25’s picture

I tried using "today" as the filter for the Node Post Date, but this is not working. When I preview it, no results show, and when I look at the query, it shows ....WHERE node.created = ***CURRENT_TIME***-61200.

nevets’s picture

You need to select relative date.

You may also want/need the date module. It includes a date filter that allows you to specify granularity (in your case you would pick day).

i25’s picture

It's still not giving me any results, and I do have the Date module installed. Here is a screenshot of my settings: www.mwebdev.com/at/view.jpg

nevets’s picture

Try now instead of today (though both are supposed to work).

If you do a preview, what does the generated sql look like?

i25’s picture

"Now" doesn't work either. Here is the generated SQL:

SELECT node.nid AS nid,
node.title AS node_title,
DATE_FORMAT((FROM_UNIXTIME(node.created) + INTERVAL -14400 SECOND), '%Y%m%d') AS node_created_day
FROM node node
WHERE node.created = 0
ORDER BY node_created_day DESC

i25’s picture

Anything? Please see my last post. Thanks.

i25’s picture

Any thoughts on why this is not working? Any suggestions?

i25’s picture

Guys,
I still can't get this to work. It doesn't matter what criteria I place in the date filter, I still get the same results. Placing "now" or "today" in the date filter does not narrow down the results.

i25’s picture

Anything guys? This has to be a common question/requirement, although I can't find anything online that gives me good results...

Can someone PLEASE help me with this problem? I'm trying to configure a view to show items with a post date in the past day. I've tried "is equal to" "now" and "today" and "-1 day" but nothing is returning results.

Any ideas?

Thanks!

steveadamo’s picture

These are some of the settings I have for my block (that shows upcoming events, if any, and displays the empty text string otherwise):

Defaults: Configure filter Date: Date (node)

Relationship: none
Operator: is greater than or equal to
(no values for year month or day selected)
Date default: now

Defaults: Configure extra settings for filter Date: Date (node)

Date form type: select
Granularity: day
Date year range: -3:+3
Date field(s): Content: Date (field_date) - From date (one of my own custom content date fields)
Method: or

The fields I display are the node title, and the custom content date from above.

i25’s picture

What settings do I need to have to simply show items with a post-date of the current date? I can't use "is equal to" "now" because that seems to interpret "now" quite literally (as in right now), and "today" is not bringing back any results. I tried "is greater than" "-24 hours" and that brought back some results, but that won't always show items posted only on the current date.

I just need to show items posted on the current calendar date.

steveadamo’s picture

Just out of curiosity, have you set the "granularity" as I indicated in my last post? That should help narrow the resultset.

i25’s picture

I did not set the granularity. I don't see any extra settings for the Node: Post Date.

Any further ideas? Thanks.

steveadamo’s picture

in my particular situation, im using a custom CCK date field... perhaps thats the missing piece here?

i25’s picture

Hmmm... looks like that's it. I tried adding a filter for a CCK date field and I can see the granularity setting. It seems like everytime a possible solution presents itself, something prevents me from using it.

Is there anyway to have a CCK date field be populated with the Post Date field data for a node? If this is possible, I could create a CCK date field and have it populated with the same data as the Post Date.

Any thoughts guys? It seems like it would be a bit easier than this to filter by the current date. Any suggestions?

i25’s picture

Any suggestions guys? I'm really bumping my head on this one!

i25’s picture

Please help! I'm lost and I still can't find anything that is helping me with this date question!

i25’s picture

I'm open to suggestions on different ways of doing this as well. Any help would be enormously appreciated. Please see the last few posts. Thanks!

Pieter Maes’s picture

this is somewhat related and could maybe help if setup in a different manner
if you use the scheduler module you can use between -24 hours and 24 hours, then set the publishing time to 00:00:00 and run cron just after 00:00:01 the you should have

eärendil’s picture

Here is a link to the PHP Date manual: http://php.net/manual/en/function.date.php

So, to get the current date, you could put something like:

F j, Y  

This will get you the Month, Day and Year.

PHP gives you a number of date options, just follow that link and check out some of the examples they give you.

rakesh.gectcr’s picture

Please enter the date like this
CCYY-MM-DD HH:MM:SS => 2014-03-01 00:00:00

---
Kind regards,

Thank you,
Rakesh James

programmerdiego’s picture

For Drupal View: A date in any machine-readable format. CCYY-MM-DD HH:MM: SS is preferred.

This worked for me. I used it in a feeds view and entered the date in this format: 2024-05-15 00:00:00.