By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

locale

P: n/a

I am finding a lot of confusing information with regard to date & time
locale.

I wish to display the local client time on a web page. What is the recommended
way of going about this? How does the server know the locale of the
client? Is it set by the web server from initiation data sent by the
clients browser?
Feb 19 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 19 Feb, 12:59, Richard <rgr...@gmail.comwrote:
I am finding a lot of confusing information with regard to date & time
locale.

I wish to display the local client time on a web page. What is the recommended
way of going about this? How does the server know the locale of the
client? Is it set by the web server from initiation data sent by the
clients browser?
Easiest way is to use javascript which runs on the client machine and
thus will use the client machine time.

Feb 19 '07 #2

P: n/a
Richard wrote:
>
I am finding a lot of confusing information with regard to date & time
locale.

I wish to display the local client time on a web page. What is the
recommended way of going about this? How does the server know the
locale of the client? Is it set by the web server from initiation
data sent by the clients browser?
You really have no way of knowing by using server-side scripting, as
the local time is never sent as a request header from the browser. The
usual request headers, at least from Opera (9.10) are (aside from the
request itself):
User-Agent: (browser details)
Host: (hostname/port used in the request)
Accept: (MIME types accepted)
Accept-Language: (browser language settings)
Accept-Charset: (character sets accepted)
Accept-Encoding: (encoding types accepted, such as "gzip")
Connection: (usually either "Keep-Alive" or "Close")

In any case, your best bet to find out the time local to the user, is
to use JavaScript (or another client-side scripting language).

However, I don't see the usefulness of showing the user's local time in
the browser, when just about all operating systems show the local time
in some corner. By default, Windows (up to and including XP, at least)
and most Linux-based desktops (KDE and Gnome) show this in the
bottom-right corner. Mac OS X shows this by default in the top-right
corner. If it's not showing in the operating system, it's because the
user has switched this setting off.

--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Feb 19 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.