How can a custom Drupal date format be added?

为君一笑 提交于 2019-12-18 14:03:41

问题


How do you add a custom Drupal date format. I want to display the date without hours and minutes, but the options don't include it.


回答1:


Do the following:

  1. Administration » Configuration » Regional and language » Date and Time

  2. There you will see a tab for format.

  3. Create a new format string "Y-M-d".

  4. Make this as your default for all date fields and you won't see the seconds any more.

  5. You don't need the date module for basic formatting.

Cheers, Vishal

Below is the image so that you know where it is.




回答2:


You will see a button Add format in this path admin/config/regional/date-time/formats

Then, type your format there. This will help you: http://php.net/manual/en/function.date.php

After adding your format, you can choose in the tab Types

Oops. I had this tab open in my browser for long time and didn't see the other answer.



来源:https://stackoverflow.com/questions/8375674/how-can-a-custom-drupal-date-format-be-added

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!