Skip to main content

Posts

Showing posts with the label DateTime

How to Create Time Range Array in PHP

If you want to provide a time picker dropdown for selecting time, then there are many options to do that. You can use jQuery plugins to provide a time picker to the user or generate a custom time picker dropdown with PHP. If you are concern about the web page load time, then it will be better to use custom time range dropdown for selecting time. Using PHP you can easily create a time range array that helps you to generate time picker drop-down HTML. In this short tutorial, we’ll show you how to create time range in PHP and display a time picker dropdown using time range array . For better usability we’ll place all code into a PHP function called create_time_range() . Using create_time_range() function you can easily get the range of times based on your required time duration. The create_time_range() function creates an array of time range with specified time interval. The create_time_range() function accepts four parameters and returns the time range array. $start » Required. Sp...