Reference no: EM132211183
Write a program in PHP.
Instructions:
1. Create the function with parameters of hours, minutes, and meridian.
2. If meridian value is AM, display the resulting time: same as hours & minutes.
3. If meridian value is PM, display the resultuing time: Hours = (hours + 12) and Minutes = same minutes.
#Create a Function to convert 24-hours to 12 hours time.
1. Create function with parameters of hours and minutes.
2. If hours is equal to 12 and minutes is equal to 0, display the resulting time is NOON of same hours and minutes.
3. If hours is equal to 12 and minutes is greater than 0, display the resulting time is PM of same hours and minutes.
4. If the hours is less than 12, display the resulting time as AM, of same hours and minutes.
5. If hours is greater than 12, display the resulting time is PM, of Hours = (hours - 12) and Minutes = same minutes.
In the Main Program:
1. Create a random variable ($hrs1) of range 1 to 12: for hours, to convert if from 12Hour to 24Hour Time.
2. Create a random variable ($mer) of range 1 to 2. (If $mer = 1, then Meridian is AM. If $mer = 2, then Meridian is PM).
3. Create a random variable ($hrs2) of range 1 to 24: for hours, to convert it from 24Hour to 12Hour.
4. Create a random variable for Minutes ($mins), of range 0 - 59.
5. Execute 12hr to 24hr funtion, passing $hr1, $mins, and $mer as parameters.
6. Execute 24hr to 12hr function, passing $hr2 and $mins as parameters.