Closed (won't fix)
Project:
Date
Version:
6.x-2.4
Component:
Date API
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 May 2010 at 16:16 UTC
Updated:
26 Oct 2018 at 02:59 UTC
Jump to comment: Most recent
Hey all,
I ran into this yesterday when theming a cck date field.
I can make date_format_date() work with long, medium, or short, but not mycustomformat.
I notice that mycustomformat is in the database table date_format_types, and the only difference between it and the other, default types, is that locked is set to 0.
Cleared cache, etc.
To replicate, create a custom format with a custom display format (why are these both called 'formats'? This should be changed). Create a field that uses another format for display. Now, attempt to use the custom display format in the following programmatic way:
$date_raw = $field_date[0]['value']; //Get datestamp from cck field, could use $node->whatever
$date_object = date_make_date($date_raw); //Format_date wants a date object, so create one
$formatted_date = date_format_date($date_object,'mycustomtype');
print $formatted_date;
Comments
Comment #1
rukaya commentedI think this is pretty similar to this issue http://drupal.org/node/677778, so apparently you just aren't meant to use date_format_date for this. I really want to know how to be able to format dates using a custom format which was defined through that admin interface too though, does anybody know how to do it?
Edit: this was logged as a bug in D7 http://drupal.org/node/826486 and has now been fixed, looks as if it's not possible to do for 6.x though. In the token module there's a patch to get a token for your custom date http://drupal.org/node/998156 but it's not been committed.
Comment #2
zeutyYou can use:
Comment #3
damienmckennaUnfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.