Submitted by admin on Thu, 09/05/2019 - 16:45

Image removed.

One of our members had this question for us:

"I'm using the Date module and I would like it to display morning as AM and evening as PM. At the moment it shows 15:00, but I'd like it to show 3 PM".

In this tutorial, we'll answer that question and show you how to set up Date and Time formats in Drupal.

  • Install the Date module.
  • Go to Structure > Content type > Manage fields.
  • Create a Date field.
  • Click the Manage Display tab.
  • Click the cog next to your Date field and you'll see the 3 default formats:
Image removed.
  • Go to Configuration > Date and Time and you'll see those 3 formats:
Image removed.
  • Click the Formats tab.
  • Click Add format.
Image removed.
  • You'll now see and empty box. Click the PHP manual link:
Image removed.
  • You'll be taken to PHP.net with a list of ways that PHP can show dates.
Image removed.
  • Find the data formats that you want and paste them into your Drupal site. For example, "j F, G A" will show as "30 December, 1 PM". On the right hand side, Drupal will give you a live preview of your format.
Image removed.
  • Click Add format.
  • Click Types.
  • Click Add date type.
  • Enter a name for your new Date type.
  • Choose the Date format:
Image removed.
  • Click Add date type. You'll now see your new format:
Image removed.
  • Go to Structure > Content types > Manage Display.
  • Choose your new date and time format:
Image removed.
Solutions Img