473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

how to determine client's local time ?

I'm just lost here.. Is there a function to determine current time on
the client's computer clock ?

Links / Pointers?

Mike

Jul 17 '05 #1
12 3018
>I'm just lost here.. Is there a function to determine current time on
the client's computer clock ?

Links / Pointers?


PHP runs on the server, not on the client.

Javascript is Turned Off (tm).

Gordon L. Burditt
Jul 17 '05 #2


Gordon Burditt wrote:
I'm just lost here.. Is there a function to determine current time on
the client's computer clock ?

Links / Pointers?


PHP runs on the server, not on the client.


Well something to extract from http headers / or something from tcp
packets (ouch!!!) ???

Mike

Jul 17 '05 #3
>> >I'm just lost here.. Is there a function to determine current time on
>the client's computer clock ?
>
>Links / Pointers?


PHP runs on the server, not on the client.


Well something to extract from http headers / or something from tcp
packets (ouch!!!) ???


You can't extract information that isn't there. HTTP headers sent
from the client to the server might include timestamps in
"if-modified-since" headers but they aren't CURRENT timestamps and
could easily be months old.

Javascript is still Turned Off(tm).

Why do you need this information?

Gordon L. Burditt

Jul 17 '05 #4
IIRC, the timestamp in TCP packets is a tick count from when the
computer was booted up and not the actual time.

Jul 17 '05 #5
OH PLEASE TURN JAVASCRIPT ON !!

In fact, I need to know what date it is on client side to serve them
content which is date specific..

Mike

Gordon Burditt wrote:
>I'm just lost here.. Is there a function to determine current time on
>the client's computer clock ?
>
>Links / Pointers?

PHP runs on the server, not on the client.


Well something to extract from http headers / or something from tcp
packets (ouch!!!) ???


You can't extract information that isn't there. HTTP headers sent
from the client to the server might include timestamps in
"if-modified-since" headers but they aren't CURRENT timestamps and
could easily be months old.

Javascript is still Turned Off(tm).

Why do you need this information?

Gordon L. Burditt


Jul 17 '05 #6
*** siliconmike wrote/escribió (6 Jul 2005 22:09:22 -0700):
In fact, I need to know what date it is on client side to serve them
content which is date specific..


So visitors from Asia and Europe can access the contents a few hours before
those from America?
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #7
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

siliconmike wrote:
OH PLEASE TURN JAVASCRIPT ON !!


Why not try comp.lang.javascript? I think you will get better answers there.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCzQytZeVxmdI1of8RAq6TAJ47sjy8iP/fopSH9UhVVHlnLDNsXQCg4A33
rknARP7jsCRxkm4XPiVdM90=
=ERqH
-----END PGP SIGNATURE-----
Jul 17 '05 #8
>OH PLEASE TURN JAVASCRIPT ON !!

As long as it can be used to write spyware, it stays off.
As long as it can be used to open two windows when you close one,
it stays off.
In fact, I need to know what date it is on client side to serve them
content which is date specific..


Are you assuming that the client machine has the clock set anywhere
near correctly? As in within 1 year of the correct date? I don't
think that's a very safe assumption.

Gordon L. Burditt
Jul 17 '05 #9
I'm pretty sure you can determine what timezone the person is in based
on their IP address.

javascript can stay off.

Jul 17 '05 #10
>I'm pretty sure you can determine what timezone the person is in based
on their IP address.
Given the existence of dialup lines and international telephone
calls, that's going to be difficult to do 100%. Given the existence
of things like AOL (and other ISPs) web proxies, it's even harder
to do this 100%. You might manage to do "close enough", although
it wouldn't surprise me if quite a few people near a timezone
boundary who use dialup lines dial across the boundary.

Then there's the mobile wireless users.

Assuming that this is something the user DOESN'T WANT to spoof,
you could try asking the user what his time zone is, using your
best guess at the time zone as the default.
javascript can stay off.


Gordon L. Burditt
Jul 17 '05 #11
It's important to bear in mind that there is no absolute time. If a
visitor had been moving at close to the speed of light, then the
difference between the client time and server time could be days,
perhaps even years.

One should not neglect either those who are still partying like it's
1999.

Jul 17 '05 #12
On 6 Jul 2005 14:30:34 -0700, "siliconmike" <si*********@yahoo.com>
wrote:
I'm just lost here.. Is there a function to determine current time on
the client's computer clock ?


You can use Javascript on the client to set a cookie with their
current timezone offset and then read that timezone offset in PHP and
adjust all your times appropriately.

I do that exact thing in a number of my sites so all the dates/times
are shown in the users local timezone.

Jul 17 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: pwldev | last post by:
Sorry if this isn't a good place for this question. I have a problem with losing cookie values whenever a user's local machine date/time is behind the date & time of the IIS machine. The login...
4
by: Elie Grouchko | last post by:
Hi All 1. I need to convert the local-time of the server on which I run my website to UTC and I don't want to rely on the server local time and timezone (i.e. I don't want to hardcode the...
0
by: pduncan | last post by:
Hi all, I need to update client machines with the correct time if it is inaccurate. The server I'm using will always have the correct time so I'll be using that as the source of correct time. ...
8
by: Zvonko | last post by:
Hi! I would like to get the clients date and time (his system time) and store it somewhere so I can use it in my code later. (insert it to database!). Any ideas Zvonko
2
by: David Berman | last post by:
Suppose you have a bulletin board where of course people can post messages and read messages composed by other people. Each message has a time stamp on it. When someone in California comes to the...
4
by: Selden McCabe | last post by:
Does anyone know how to determine the client's MAC address from within ASP.Net? I suppose it would have to be java or vb script running on the browser, but I haven't been able to find an...
3
by: Bidyadhar Patra | last post by:
Hai, Could any body help me out in finding out the Client Perceived Response Time for an ASP.Net application. CPRT is measuring the time it takes for a page to load from browser click to...
4
by: Marco Shaw | last post by:
Some examples in datetime format: Thu, 25 Jan 2007 10:22:39 -0500 Thu, 25 Jan 2007 09:12:17 -0800 Thu, 25 Jan 2007 10:26:04 -0800 Thu, 25 Jan 2007 10:27:26 -0800 Thu, 25 Jan 2007 19:28:28 +0000...
4
by: sahkav | last post by:
How can I get client's local time and date by identifying their Time Zone. How can I find out their ISP's DAte and time ? Thanks Sahkav
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.