tags:

views:

269

answers:

3

Is there any way by which we can find Date Format as set in the computer where web pages are loading?

I want to show date in my web pages according to what is set in client machine system.

I have seem an ASP based web page which lists all the system setting of a clients system including information of drivers installed!

So if it is possible in ASP then I think this should be possible in PHP also!

A: 

In a web page running on a client's machine, you can access what is provided by the browser - nothing else (by design, for security reasons). You cannot, for example read or write a file.

If you are talking about linguistic and cultural aspects of displaying a date, then you need to look at the Locale: Javascript for example has a method Date.toLocaleDateString().

If you are talking about something else (eg the particular textual layout adopted by the operating system), no you cannot find out.

Colin Fine
A: 

you need use a module in apache that call geoip, you can recognize the country of the user, then you can set the time zone to show it to user in him time zone

: example

<?php

date_default_timezone_set('Europe/London');

if (date_default_timezone_get()) { echo 'date_default_timezone_set: ' . date_default_timezone_get() . '
'; }

if (ini_get('date.timezone')) { echo 'date.timezone: ' . ini_get('date.timezone'); }

?>

you can read about http://php.net/manual/en/class.datetimezone.php

Haim Evgi
I think this will do the trick. I will try this out as a work around.
Yogi Yang 007
+1  A: 

Unfortunately, there is no such information available to server PHP script. You can examine HTTP headers. There are often headers

Accept-Language
Accept-Charset

Those can be use to identify user language and guess his preferences (guess not retrieve his real preferences).

More complicated approach is to use Javascript function dateObject.toLocaleDateString() and try to parse that and identify user preferences in the browser and send that information to the server. I don't know of any library that can do that, but you may try to find that.

Jiri
Just for the record, if everything else fails, you could also try to guess the locale of the computer based on the geographic location of the IP.
DrJokepu