Hi,
I'm trying to use theme_date_display_combination from within a template, but I can't figure out the format of the $element argument that should be passed to it. I have a node with a date field on it, and I've tried something like this in my template:
print theme('date_display_combination',$node->field_date[0]);
... where $node->field_date[0] accesses the value of my CCK date field, but this doesn't work. Is there a function I can pass that CCK value to, to create an 'element' for the theme function?
I should note that my CCK field has both 'from' and 'to' values in it. The date field is an array like this:
Array
(
[value] => 2009-10-29 11:30:00
[value2] => 2009-10-29 13:00:00
[timezone] => America/Chicago
[timezone_db] => America/Chicago
[date_type] => datetime
)
Thanks for any help!
Comments
Comment #1
marblegravy commentedI'm having the same difficulty trying to figure out what to pass to date_display_combination as $element in order to display both the to and from dates on a custom page template.
I've done the same thing as Chadwick which as he says - doesn't work. I could re-build a new function to do the formatting, but it just seems like a waste when that's what this function is set up to do!
Is there a different function that we should be calling first that generates the $element object?
Additional notes:
I can use the function custom_format_cck_date_value from http://drupal.org/node/295105 to display the From value.
I can also create a 'dumb' version of what I'm after with:
(the field eventdate contains both a to and from date.)
... but I'm sure i should be able to use *something* to smartly print out the from -> to dates depending on what they are: ie - 12 Mar 2011 10am-12pm, or 12 Mar 2011 (All Day), or 12 Mar 2011 10am - 13 Mar 2011 2am.
My interim fix (in case it helps anyone else...)
So I've given up and gone for an interim fix where the event times are not shown. I set up the 'short' formatter to display the date as 11 May 2011 and modified my code above like this:
Comment #2
devkinetic commentedI've run into this issue as well. What is the solution to printing to/from date fields from a node template?
Comment #3
damienmckennaWe're sorry but the D6 release of Date module is no longer being supported. You are encouraged to update to Drupal 7 or 8, or direct questions to Drupal Answers.