Sabbir
Sabbir

Reputation: 1

php time function

How can I get the current time,for example, in 10:45:47 am format using php? can anyone help me by answering the above question? Thanks to all.

Upvotes: 0

Views: 572

Answers (3)

Brad
Brad

Reputation: 163752

date("h:i:s a")

http://php.net/manual/en/function.date.php

Upvotes: 5

Tyler Carter
Tyler Carter

Reputation: 61547

$time = time();
$date = date();

Upvotes: 0

Sarfraz
Sarfraz

Reputation: 382606

You can use the date function like this:

echo date('h:i:s a');

See the formatting options for the date function to get more idea about it :)

Upvotes: 2

Related Questions