answersLogoWhite

0

This question is ambiguous to completely answer, because displaying a digital clock has different interpretations. In the following, a digital clock is assumed to be 2 digits for the hours and 2 digits for the minutes with a colon in between, styled at your discretion to look like a digital clock.

If you want to display the time statically as of the page loading, grab the current time() and throw it into date($format, $time). The time() function will retrieve the current time in seconds from the Unix Epoch (1/1/1970). The date() function will take this timestamp and format it, according to the format string given. See the related link for complete documentation on possible formats. The following example works fine:

$time = time();

$format = 'h:i A'; // "h" is the current hour, "i" the current minute, and "a" AM or PM.

echo date($format, $time);

This will effectively output the time as a digital clock would. You may change the format to alter how the hours and minutes are displayed, and even provide more (or less) information about the current time.

If you want to display the time and have it dynamically update to reflect the current time, you will need to use Javascript -- which is out of the scope of this question.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Is there a clock that a person with poor eyesight can read?

A digital clock with a large display.


What is a digital clock face made out of?

what is a clock made out of


What energy transformation takes place in a digital clock?

In a digital clock, electrical energy is transformed into light energy when the LED or LCD display lights up to show the time. The electrical energy powers the circuitry of the clock which then activates the display to emit light.


Is digital clock a digital device?

1. Generally speaking, a digital clock is a digital device. The "heart" of any clock is whatever is used as its time base, and with a digital clock, some kind of digital timing circuit supplies that time base. From there, digital dividers and other circuits count seconds, and other circuits drive a display. 2. Yes by definition it is.


When was the first digital alarm clock invented?

The first digital alarm clock was invented in 1956 by D.E. Protzmann, an engineer at General Electric. This alarm clock featured a digital display and the ability to set specific alarm times, setting the foundation for modern digital alarm clocks.


How do you display digital clock using shell script?

Digital CLOCK on your Screen Using Unixechoecho "Digital Clock for unix"echo "To stop this clock use command kill pid see above for pid"echo "Press a key to continue. . ."while :doti=`date +"%r"`echo -e -n "\033[7s"#save current screen position & attributestput cup 0 69# row 0 and column69 is used to show clockecho -n $ti# put clock on screenecho -e -n "\033[8u"#restore current screen position & attributessleep 1done


What is the energy transformation in a digital clock?

In a digital clock, electrical energy from the battery or power outlet is transformed into light energy in the form of the display. The clock uses electronic components to process the electrical energy and produce the output of light to show the time.


How many times would a digital clock display the same numbers in a 24-hour day?

i think its 17


How many times will a digital clock display three or more of the same number in a row over a curse of the day?

34


How many times a day does a digital clock display digits whose sum total equals the number of led's used to display them?

A 24 hour clock displays digits whose sum total equals the number of led's used to display them 94 times a day. A 12 hour clock displays them 108 times a day.


What is this digitel electroics?

Digitel is a company, Usually the term digital is only used to differentiate a product display from analog when referring to a clock.


What is the definitioin for analog clock?

An analog clock is one with an analog display (that shows you the time by means of a flat dial marked with the hours of the day and one or more pointers (hands) that point to the time of day on that dial). A true analog clock should also have a mechanical means for keeping the time and driving the pointers.Conversely a digital display would show you the time directly as numbers which change as the time passes and a true digital clock would calculate the time using a digital/electronic mechanism (a computer).