开发者

Drupal date formatting

In lieu of using php's date() function directly, I'd like to trigger a date format that I've created at admin/settings/date-time/formats.

At first glance I thought I could do this:

format_date(st开发者_StackOverflowrtotime($date), 'customformat');

But it looks like format_date() has a few formats hard-coded and doesn't communicate with the date/time formats. I could use $type='custom' but that would be just like php's date() with some timezone logic. Of course I want to define date formats in one place, and use those formats in my code.


You can select in the admin interface how short, medium and long formats for format_date should look like, but you can't define extra formats like, mycustomformat.

What makes format_date different than date, is that the result is translatable. Very handy for sites that aren't english.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜