I need to create an array for time that I will use in a HTML dropdown. The array keys should be in 24 hour format and value in 12 hours with am and pm. In the database I want to store the 24h format. Is there a quick way to create the array instead of typing each hour?
example:
'00:00:00' => '12:00am',
'01:00:00' => '1:00am',
etc
Use a loop:
This would ouput: