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

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.

This question has already been answered. Start a new discussion instead.