Our organization's style guide expects dates in this format:
Oct. 31 2018 01:30 p.m.
I looked the date format drop-down in our views, and there were several options, including a custom one. However, I noticed that none of these are able render the post meridien with abbreviating periods.
There is option for a custom date format, but it seems to use the encoding for PHP date()
function. Looking at the manual, there is a
, which gives me pm
, and A
, which gives me PM
, but I don't see anything specifying one with periods.
I looked in the code base for where date formatters are stored, and they all seem to be yaml files specifying date()
formats:
$ cat core/modules/system/config/install/core.date_format.html_yearless_date.yml
...
pattern: m-d
...
So it seems that the built-in custom date formats are limited to what can be specified with PHP's date()
function.
I googled for ways to create a custom date format, but only found explanations of where to specify a custom date format: https://www.ostraining.com/blog/drupal/d8-dates/
How can I create a date formatter where I can use PHP code to give myself a date format with properly abbreviated meridiens?
date.formatter
service uses the native PHP date formatting when using custom formats.