Dates with am/pm in format for time not displaying

Created on 19 October 2012, over 12 years ago
Updated 16 May 2025, 3 days ago

Using the following code:

  $date_format = 'Y-m-d h:i A';
  $today = date($date_format);

  if (isset($blogentity->live_on_date)) {
    $the_date = date($date_format, $blogentity->live_on_date);
  }
  else {
    $the_date = $today;
  }
  $form['live_on_date'] = array(
    '#type' => 'date_popup',
    '#title' => t('Date this blog goes live'),
    '#default_value' => $the_date,
    '#date_format' => $date_format,   // Uses the PHP date() format - http://php.net/manual/en/function.date.php
    '#date_increment' => 5,
    '#date_year_range' => '-3:+3', // Limits the year range to the next two upcoming years
    '#required' => FALSE,
    '#weight' => 130,

does not work for me. Neither the date nor time display in their popup fields. Same thing for:
$date_format = 'Y-m-d h:iA';
$date_format = 'Y-m-d h:ia';
$date_format = 'Y-m-d h:i a';
$date_format = 'Y-m-d h:i A';

However, military time works just fine:
$date_format = 'Y-m-d H:i';

πŸ› Bug report
Status

Closed: outdated

Version

2.6

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States aangel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024