0

I need change time from 24h to 12AM/PM .. I select time am/pm but result 24h

 foreach ($bookings as $booking) {
                $b_date = DateTime::createFromFormat('Y-m-d H:i:s', $booking->b_date . ' 00:00:00');
                $booking->b_date = $b_date->format($date_format);
                $b_date->modify("+{$booking->b_time} minutes");
                
                $b_create_date = DateTime::createFromFormat('Y-m-d H:i:s', $booking->b_create_date);
                $booking->b_create_date = $b_create_date->format($date_format .' H:i');
    foreach ($bookings as $booking) {
                $start = DateTime::createFromFormat('Y-m-d H:i:s', $booking->b_date . ' 00:00:00');
                $start->modify("+{$booking->b_time} minutes");
                if ($start >= $start_date_time && $start <= $end_date_time) {
                    $end = clone $start;
                    $end->modify("+{$booking->b_service_duration} minutes");
                    $booking->start = $start->format('Y-m-d H:i');
                    $booking->end = $end->format('Y-m-d H:i');
                    $booking->b_service_duration_display = $hours[$booking->b_service_duration];
                    $bookings_filter[] = $booking;
                }

            }

I change 'H:i:s' to "g:iA" but not work

Sammitch
  • 30,782
  • 7
  • 50
  • 77
  • 2
    Show us the actual changed code, and the result it generated. "it didn't work" doesn't give us anything to work with to determine the problem. – Sammitch Dec 16 '22 at 22:16
  • Please let us know if the linked duplicated helped -or- if not, [edit] your question and add all the details that make it distinct from that and other similar Q&A material on site. Welcome to SO & Thanks again! – hakre Dec 16 '22 at 22:30

0 Answers0