Hi,
When in google you type time or date ...
it display answer - correct time means get your time zone and converted to correct time...

e.g. suppose you are in india ..
it automatically detect time zone convert it added +5.30
and display result.

same as whether you are in us or uk ..so it display correct time for you...

same functionality i want to use to display time...

How to do this??
any google api or ??

Google probably geocode your IP address, then look up the corresponding timezone for that part of the world.

Google for geocoding IPs. It isn't 100% accurate, but should be close enough for timezones.

Google probably geocode your IP address, then look up the corresponding timezone for that part of the world.

Google for geocoding IPs. It isn't 100% accurate, but should be close enough for timezones.

So how to display time like google??
any link or sample please ??

Store the time as a UNIX timestamp (the number of seconds since January 1, 1970 if I remember correctly). There are built in php functions to convert a UNIX timestamp to a particular time, given a timezone.

hi,
When anybody visit my site..
i didn't take any time zone or country for registration...

When anybody visit my site..i want to display his time and date..
so how find time like google using ip or anything ??

YA i would guess that finding ip/host than getting zip code to look up zip would be the best way of going about this.

You will need a GeoLocation database like IP2Location which has the time zone for that particular IP address. Then you can just grab the server time and offset the time zone.

Alternatively, you can also use JavaScript like http://www.tizag.com/javascriptT/javascriptdate.php and get the date and time on the client side. But this may be inaccurate if the date/time on the client computer is wrong. It also will not work if JavaScript is not supported on that browser or it is disabled.

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.