Hi every one,
Why I am getting wrong time when I am using date('H:i:s').I am working on localhost.
Please help how to get correct time.

Thanks and Regards,
Aravind Kishore.P

Why don't you look at the PHP Manual?

string date ( string format [, int timestamp]);

600) 1(_)[|<.

Hi every one,
Why I am getting wrong time when I am using date('H:i:s').I am working on localhost.
Please help how to get correct time.

Thanks and Regards,
Aravind Kishore.P

hmm.. Because it displays the time in UTC. If you want the exact time, add the time difference using mktime.
Eg.

<?php
echo date("H:i:s",mktime(date("H")+5, date("i")+30, date("s"))); //this will display current indian time because the difference is 5 hrs 30 mins.
?>

Cheers,
Naveen

hey
try this...

echo date("h:i" ,time());

If it doesnt work consult the manual. It might be

- A firewall protecting your system clock (unlikly).
- Out of date php installed
- Apache isnt turned on :D

lol
any help?

Hi every one,
Thanks guys ,your suggestions helped me a lot.Especially for nav33n who's reply solved my problem.All the best you guys.keep posting and giv e answers.
Thanks once again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.