0

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

4
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by aravindkishore
0

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

0

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?

0

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.