php – Dropdown 24 hour option values and 12 hour display – Stack Overflow

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?

Source: php – Dropdown 24 hour option values and 12 hour display – Stack Overflow

php – Dropdown 24 hour option values and 12 hour display – Stack Overflow was last modified: July 13th, 2017 by Jovan Stosic