locale

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard

    #1

    locale


    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?
  • Captain Paralytic

    #2
    Re: locale

    On 19 Feb, 12:59, Richard <rgr...@gmail.c omwrote:
    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.

    Comment

    • =?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=

      #3
      Re: locale

      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ø
      - kimandre@NOSPAM betadome.com
      (remove NOSPAM to contact me directly)

      Comment

      Working...