473,796 Members | 2,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

detecting user's timezone

Hi,

I wonder if it's possible to detect a user (the browser's) timezone
when he/she access my php file? I saw ppl suggesting using javascript
to collect that information. But I wonder if it's possible to do it
without the headache of javascript.
Thanks,
<?php
// (1) here I somehow get his/her timezone
// (2) here fill his/her login timestamp into database----
apparently, this timestamp should be converted to a unified time
zone.
?>

Jul 6 '07 #1
18 12117
newbie wrote:
Hi,

I wonder if it's possible to detect a user (the browser's) timezone
when he/she access my php file? I saw ppl suggesting using javascript
to collect that information. But I wonder if it's possible to do it
without the headache of javascript.
Thanks,
<?php
// (1) here I somehow get his/her timezone
// (2) here fill his/her login timestamp into database----
apparently, this timestamp should be converted to a unified time
zone.
?>
Nope. You need something which will run on the client's system to check
the timezone setting - i.e. javascript.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 7 '07 #2
On Jul 6, 7:25 pm, newbie <mitbb...@yahoo .comwrote:
Hi,

I wonder if it's possible to detect a user (the browser's) timezone
when he/she access my php file? I saw ppl suggesting using javascript
to collect that information. But I wonder if it's possible to do it
without the headache of javascript.

Thanks,

<?php
// (1) here I somehow get his/her timezone

// (2) here fill his/her login timestamp into database----
apparently, this timestamp should be converted to a unified time
zone.
?>
If you're converting the time to a "unified time zone" why do you care
what timezone they're in? Why would you be recording the time from
the client in your database?

Jul 7 '07 #3
ZeldorBlat kirjoitti:
If you're converting the time to a "unified time zone" why do you care
what timezone they're in? Why would you be recording the time from
the client in your database?
Not record, just show. Naturally it makes sense to record a global time
timestamp, like GMT, but people still like to see a time displayed in
their local timezone, so the OP wants to know how to get it and then
convert GMT to local time, just for _displaying_ it to user. It's common
localization practise. Wikipedia for one does this.

--
Ra*********@gma il.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
Jul 7 '07 #4
Rami Elomaa wrote:
ZeldorBlat kirjoitti:
If you're converting the time to a "unified time zone" why do you care
what timezone they're in? Why would you be recording the time from
the client in your database?

Not record, just show. Naturally it makes sense to record a global time
timestamp, like GMT, but people still like to see a time displayed in
their local timezone, so the OP wants to know how to get it and then
convert GMT to local time, just for _displaying_ it to user. It's common
localization practise. Wikipedia for one does this.
I've got two analog clocks on the walls, a watch on my wrist, and a
digital clock on my toolbar. What makes you think I need your site to
tell me what time it is?

As for Wikipedia - I don't see any clock on the pages when I view them.

You can include a clock if you want - but it looks stupid.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 8 '07 #5

"Jerry Stuckle" <js*******@attg lobal.netschree f in bericht
news:MK******** *************** *******@comcast .com...
Rami Elomaa wrote:
>ZeldorBlat kirjoitti:
> If you're converting the time to a "unified time zone" why do you care
what timezone they're in? Why would you be recording the time from
the client in your database?

Not record, just show. Naturally it makes sense to record a global time
timestamp, like GMT, but people still like to see a time displayed in
their local timezone, so the OP wants to know how to get it and then
convert GMT to local time, just for _displaying_ it to user. It's common
localization practise. Wikipedia for one does this.

I've got two analog clocks on the walls, a watch on my wrist, and a
digital clock on my toolbar. What makes you think I need your site to
tell me what time it is?

As for Wikipedia - I don't see any clock on the pages when I view them.

You can include a clock if you want - but it looks stupid.
Perhaps the OP wants to show the user at what (local) time they last visited
/ contributed something / downloaded something, etc.
Jul 8 '07 #6
amygdala wrote:
"Jerry Stuckle" <js*******@attg lobal.netschree f in bericht
news:MK******** *************** *******@comcast .com...
>Rami Elomaa wrote:
>>ZeldorBlat kirjoitti:
If you're converting the time to a "unified time zone" why do you care
what timezone they're in? Why would you be recording the time from
the client in your database?
Not record, just show. Naturally it makes sense to record a global time
timestamp, like GMT, but people still like to see a time displayed in
their local timezone, so the OP wants to know how to get it and then
convert GMT to local time, just for _displaying_ it to user. It's common
localizatio n practise. Wikipedia for one does this.
I've got two analog clocks on the walls, a watch on my wrist, and a
digital clock on my toolbar. What makes you think I need your site to
tell me what time it is?

As for Wikipedia - I don't see any clock on the pages when I view them.

You can include a clock if you want - but it looks stupid.

Perhaps the OP wants to show the user at what (local) time they last visited
/ contributed something / downloaded something, etc.

Why? Do you think users really *care*?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 8 '07 #7

"Jerry Stuckle" <js*******@attg lobal.netschree f in bericht
news:B-*************** *************** @comcast.com...
amygdala wrote:
>"Jerry Stuckle" <js*******@attg lobal.netschree f in bericht
news:MK******* *************** ********@comcas t.com...
>>Rami Elomaa wrote:
ZeldorBlat kirjoitti:
If you're converting the time to a "unified time zone" why do you
care
what timezone they're in? Why would you be recording the time from
the client in your database?
Not record, just show. Naturally it makes sense to record a global time
timestamp, like GMT, but people still like to see a time displayed in
their local timezone, so the OP wants to know how to get it and then
convert GMT to local time, just for _displaying_ it to user. It's
common localization practise. Wikipedia for one does this.

I've got two analog clocks on the walls, a watch on my wrist, and a
digital clock on my toolbar. What makes you think I need your site to
tell me what time it is?

As for Wikipedia - I don't see any clock on the pages when I view them.

You can include a clock if you want - but it looks stupid.

Perhaps the OP wants to show the user at what (local) time they last
visited / contributed something / downloaded something, etc.

Why? Do you think users really *care*?
I didn't say *I* would use it. I was only trying to guess what the OP was
after. Also, I was gonna add that I couldn't find any real valuable use for
it, but perhaps there is. Come to think of it, and perhaps a bit far
fetched:

What if I had a bank account at some international bank and I wanted to see
at what local time I made my last payment transaction to some firm?

Just a thought.
Jul 8 '07 #8

"amygdala" <no*****@norepl y.comschreef in bericht
news:46******** *************** @news.kpnplanet .nl...
>
"Jerry Stuckle" <js*******@attg lobal.netschree f in bericht
news:B-*************** *************** @comcast.com...
>amygdala wrote:
>>"Jerry Stuckle" <js*******@attg lobal.netschree f in bericht
news:MK****** *************** *********@comca st.com...
Rami Elomaa wrote:
ZeldorBla t kirjoitti:
If you're converting the time to a "unified time zone" why do you
care
>what timezone they're in? Why would you be recording the time from
>the client in your database?
Not record, just show. Naturally it makes sense to record a global
time timestamp, like GMT, but people still like to see a time
displayed in their local timezone, so the OP wants to know how to get
it and then convert GMT to local time, just for _displaying_ it to
user. It's common localization practise. Wikipedia for one does this.
>
I've got two analog clocks on the walls, a watch on my wrist, and a
digital clock on my toolbar. What makes you think I need your site to
tell me what time it is?

As for Wikipedia - I don't see any clock on the pages when I view them.

You can include a clock if you want - but it looks stupid.
Perhaps the OP wants to show the user at what (local) time they last
visited / contributed something / downloaded something, etc.

Why? Do you think users really *care*?

I didn't say *I* would use it. I was only trying to guess what the OP was
after. Also, I was gonna add that I couldn't find any real valuable use
for it, but perhaps there is. Come to think of it, and perhaps a bit far
fetched:

What if I had a bank account at some international bank and I wanted to
see at what local time I made my last payment transaction to some firm?

Just a thought.
But then again, if I was responsible for such an application, and I wanted
to provide that kind of 'convenient' service, I would probably make a user
of this system choose their place of residence.
Jul 8 '07 #9
amygdala wrote:
"Jerry Stuckle" <js*******@attg lobal.netschree f in bericht
news:B-*************** *************** @comcast.com...
>amygdala wrote:
>>"Jerry Stuckle" <js*******@attg lobal.netschree f in bericht
news:MK****** *************** *********@comca st.com...
Rami Elomaa wrote:
ZeldorBla t kirjoitti:
If you're converting the time to a "unified time zone" why do you
care
>what timezone they're in? Why would you be recording the time from
>the client in your database?
Not record, just show. Naturally it makes sense to record a global time
timestamp , like GMT, but people still like to see a time displayed in
their local timezone, so the OP wants to know how to get it and then
convert GMT to local time, just for _displaying_ it to user. It's
common localization practise. Wikipedia for one does this.
>
I've got two analog clocks on the walls, a watch on my wrist, and a
digital clock on my toolbar. What makes you think I need your site to
tell me what time it is?

As for Wikipedia - I don't see any clock on the pages when I view them.

You can include a clock if you want - but it looks stupid.

Perhaps the OP wants to show the user at what (local) time they last
visited / contributed something / downloaded something, etc.
Why? Do you think users really *care*?

I didn't say *I* would use it. I was only trying to guess what the OP was
after. Also, I was gonna add that I couldn't find any real valuable use for
it, but perhaps there is. Come to think of it, and perhaps a bit far
fetched:

What if I had a bank account at some international bank and I wanted to see
at what local time I made my last payment transaction to some firm?

Just a thought.

And what if the moon fell and landed on the Eiffel Tower? Would it
balance there? You can come up with all kind of "what-if's".

But in your case my bank has my zip code - and knows from that what my
timezone is. It gives me that information in that timezone.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jul 8 '07 #10

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

Similar topics

9
2135
by: Google Mike | last post by:
I guess I'm confused by the whole timezone thing and I don't want to write a web app that gets this stuff wrong. I don't know how timezones work exactly -- is it just hours +/- on GMT or are there going to be minor differences on minutes and seconds too? What I want to do is have a web app that one logs into (great place for submitting the browser's view on time via Javascript) and then the user sees the records from the database with...
9
3576
by: rick cameron | last post by:
TimeZone - the only instance you can get is one representing the local time zone DateTime - cannot represent a time before 00:00:00 1 Jan 1 CE What were they thinking? This is a serious question - can anyone come up with a good reason for these incredible design restrictions? Michael Brumm http://michaelbrumm.com has produced a fix for the first problem with his SimpleTimeZone class - good on you, Michael!
3
4519
by: Ilja Booij | last post by:
Hi all, I have some trouble with the following: I'm getting a time string, in YYYY-MM-DD HH:mm:ss format, which I need to translate into a string with DD-Mon-YYYY HH:mm:ss +HHMM, where the last part is the timezone offset. I've tried to do it with the following function. This works for me, I get +0200 for the timezone part, which makes sense, because we're
2
2105
by: Vaj | last post by:
hi, i would be very thankful if u can help me in solving this problem. my problem is i 've a page in that i'm displaying the creation dates of all files. these dates are like server dates . now i've to display these creationdates in the current logged in user desktop timezone. thanks
1
1128
by: googlegroups | last post by:
We have an application that is run in many timezones and uses remoting to access the DB. I have one screen that will only save if the user is in the same timezone as the server. I can reproduce this on my development machine by simply changing the timezone. When I use remoting and a different timezone, the remoting call hits the webserver (I verified through the web server logs), but never actually makes it to the DB. I put some code...
2
4068
by: Dotnet Gruven | last post by:
Hi, If a server is physically localled in CST and is shared, how can one create a Web Application on that server that has its timezone for EST??? I've seen other threads in this group that talk about using UTC/GMT and also getTimezoneOffset(), but in this case, the business rules are such that the Web App be based upon the time zone that the physical business is located. TIA,
0
2214
by: Ninja Zombie | last post by:
Hi all, is there maybe a property on the JCC driver which, when set, will convert the selected TIMESTAMP attribute to my local timezone. The database server is in the different timezone than the client, and I have set the java property 'user.timezone' on the client to my timezone. Thanks.
7
6225
by: David Thielen | last post by:
Hi; When I get a request how can I get the user's local DateTime? I can get ultureInfo.CurrentUICulture.Calendar for a calendar but I don't see any way to turn that in to a DateTime (although you would think that would be possible). Also, is there any way to set IE to have a different timezone than my system to test this on my system (so IE is set to pacific time but my "server" is on mountain time)?
2
3689
by: =?Utf-8?B?Sm9ubnk=?= | last post by:
I have an ASP.NET 2.0 C# web application that is contacting an Exchange server using WEBDAV. It allows the users to look up appointments for a future date. The problem I have is determining the correct client time zone. Note that Exchange stores everything in UTC time. I am able currently able to use javascript to ask the client what time zone they are in, but this is only for the "today" (the current day) and not for a day in the...
0
9679
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10453
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10172
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9050
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.