Yes, I read the docs here http://drupal.org/node/123181 but I can't make any sense of it.

Here is my field: $field_event_date[0]['value']

It contains this: 2007-07-20T00:00:00

I want to make this look pretty in my theme like this:

July 20th, 2007

I tried calling theme_date_display_combination with but got an error about the params.

The function says: theme_date_display_combination($field, $dates, $node = NULL)

so what goes where?
$field = $field_event_date[0]['value'] ?
if so, then what goes in the second param?
The third one I understand.

Thanks

Comments

thomie’s picture

but what I did was use some functions from the Date module, which also brings you CCK date fields.

From the file date.inc:

 * Usage examples:
 *  create a new date object:
 *    $date = date_make_date();
 *
 *  set local value of 2006-05-04T10:24:00 US/Eastern
 *    date_set_date($date, '2006-05-04T10:24:00', 'US/Eastern', 'local', DATE_ISO);
 *
 *  display the local value using the format string 'm/d/Y H:i'
 *    print date_show_date($date, 'm/d/Y H:i', 'local');

Make sure you have the date module installed, and maybe you need to do this also:
include_once(drupal_get_path('module', 'date_api') .'/date.inc');

I think only the first two argument of date_set_date() and date_show_date() are required.

There is probably a better way to do this, but give it a try.

davea’s picture

Here is what I did:

<p class="value">
<?php
$date = date_make_date();
date_set_date($date, $field_event_date[0]['value'], '', 'local', DATE_ISO);
print date_show_date($date, 'F jS, Y', 'local');
?>
</p>

That worked great.

I dug and dug in the date.module for something like this figuring that there was some function. I appreciate the you pointing out where is was.

Thanks,
Dave
(TexasNomad)
www.ingraftedsoftware.com

sentinelcz’s picture

I am using
Date 6.x-2.0-rc2
Core 6.4
Display multiple Date formats
I read this article, but I cant view the date.
Have you some example for one CCK date field ?