Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in PHP. Instructions: 1. Create the function with parameters of hours , minutes , and meridian . 2. If meridian value is

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.

Required Output: (few possible outputs)

image text in transcribed

PROGRAM 1: Time Conversion (12-hrs into 24-hrs & 24-hrs into 12-hrs Required output (Few possible outputs localhost 8080/2016ltime x localhost 8080/2016 time x ocalhost localhost: 808 12-hours to 24-hours 12-hours to 24-hours 8 40 AM 8 40 hours 6:0 PM 18: 0 hours. 24-hours to 12-hours 24-hours to 12-hours 12 40 hours 12 40 PM 8 0 hours 8 0 AM Iocalhost8080/2016itime x localhost 8080/2016/time x ocalhost 12-hours to 24-hours 12-hours to 24-hours 10 0 PM 22: 0 hours 9 19 AM- 9: 19 hours 24-hours to 12-hours 24-hours to 12 hours 12 0 hours 12 0 noon 21 19 hours 39: 19 PM

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions