0

For a content type, I need a field holding the value of a certain date in history. The content type will be used to hold some historic events and when the current date matches (September 17th, for example) the node will be displayed.

I know that the date module can handle such things but it is quite comprehensive and I will not be using calendars or event content types. All I need is to hold a date value and compare its day and month part with the current date's.

Is there a simple solution?

  • The simple solution is the Date module...if you don't need the sub-modules you can just leave them disabled – Clive Sep 17 '13 at 8:09
  • Thank you @Clive. I go on with the date module If you gather your comments into an answer I will accept it. – turzifer Sep 17 '13 at 14:00
1

The Date module will store date time in this format: "2012-05-25 hh:mm:ss" . Using PHP's date_parse function you can extract all those values. What easier thing do you need?

-1

I think another solution is to create a long text type field and change Text processing to Filtered text (user selects text format) and give Default value (write your logic in PHP (include tags)). And save it. Then edit it one more time and change Text format to PHP code.

  • Thank you for your downvoting .. I knew it was a bad method (but it works), but there is another solution? If there is then please explain .. – xurshid29 Sep 17 '13 at 8:36
  • Not my downvote but yes, the date module is the easier solution. OP has a mis-conception that Date is overkill for what he needs (as it has a lot of optional extension modules included), but it's exactly what he needs. The wheel don't need re-inventing :) – Clive Sep 17 '13 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.