开发者

Drupal not using custom time format type

I hav开发者_运维知识库e used the "Add format type" option under Date and Time to add a format besides Long Medium and Short. My problem is that my format is being ignored and it is defaulting to Medium.

Any ideas?


In Drupal 6, custom date formats are a feature of date.module and therefore not integrated with format_date().

This has been changed in Drupal 7, where this is a core feature now.

However, you can specify 'custom' as type and then pass the desired $format in directly. You could write a simple wrapper function that gets the format from a custom date format and then passes that to format_date().


As far as I can tell digging into the code the Add Format Type option does absolutely nothing for format_date. I had to change\add this code in format_date to make it work:

case 'medium':
  $format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
default:
  $format = variable_get('date_format_' . $type, 'D, m/d/Y - H:i');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜