PHPSuperBlog.com

Display time with PHP

Editor’s note: In this post, I would like to show how to display the current server time with PHP.

We use the PHP function date( ) to display the time, we need 4 parameters for the date() function:

date (“hour,minute,second,am/pm”);

For hour:

“H” – 24 hours time system.
“h” – 12 hours time system.

For minute: “i”

For second: “s”

For AM and PM:
“A”in capital letters.
“a” in small letters.

Here are some examples:

we get: [exec]echo date(“H:i:s”);[/exec]

Press the refresh button to refresh the time.

we get: [exec]echo date(“h:i:s a”);[/exec]

Press the refresh button to refresh the time.

It can only display that instance of the server time. To make a real time clock with PHP, I only can think of using PHP code to refresh the page every second.

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Similar Posts:

Leave a comment