I have created a View. Its display format is grid.One of field is Time.

It is displayed as "Time: 1300". I need to get it printed as "Time: 1:00 pm". I am using Room Reservations module and in my reservations tab time is displayed.

Can it be done with GUI or code needs any modification?


4 Answers 4


To convert date format in Views, you have to go the settings field which you are added to view. In settings, there is a Date Format select list field. You can choose the default time format provided or you can make your custom date format by selecting the Custom from select list. A new textfield will appear "Custom Date Format". In this field, you can make your own custom date format using the link PHP Manual link provide in the description of this field.enter image description here


I believe the date field is used to create the Time field you mentioned.

You need to create new Date format in yourdomain/admin/config/regional/date-time/formats, refer the PHP date manual, in your case it will be (g a).

Followed by create the date type in yourdomain/admin/config/regional/date-time and choose the format you created. Then open your views and edit the Time field and choose the Date format what you created earlier as follows,

enter image description here


You might want to check your global time settings:


Otherwise you can check the settings of your field of your contenttype:



You may want to check if using the Views Date Format SQL module could be a solution for you. Here are some quotes about it (from its project page):

... allows to format date fields using SQL.

The core functionality is to remove the date formatting from render() and put it in query(). I.e. format date values using SQL's DATE_FORMAT rather than PHP's format_date. This is achieved by assigning a new default handler to node 'created' and 'changed' date fields. This handler extends and overrides views's build in views_handler_field_date.

The UI is completely unobtrusive, only a single checkbox "Use SQL to format dates" is added to the handler configuration popup.

Your question is not about creating charts in Drupal, but you may want to refer to this comment also for an example of how we typically use it within the Charts module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.