Thank you Jeff,

At this point, I am thinking of just presenting the user with a select box
containing all the time zones.  Does anyone have this readily available?  It
can be just a static select box with hard-coded values, or it could be a
select box populated with the records from a lookup table...

Has anyone else dealt with this issue?

Thanks in advance.

Marc

-----Original Message-----
From: Jeff Peters [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 30, 2001 12:31 PM
To: Fusebox
Subject: RE: [OT] Timezone madness


On 30 Mar 2001, at 10:57, Marc Funaro wrote:

> Although Greenwich "starts the day", different areas are + or - GMT.
> Double-click your clock on your task bar and select the time zone tab; if
> you open the dropdown box you will see the list of areas and their
relation
> to GMT.

No, I'm with you.  How you determine the zone relative to Greenwich (as -
hours
for figures including date, or as +- for hours ignoring date) is up to you.

> This is all off-subject at this point; the code I have DOES work, except
for
> this one-second "needed offset" in order for the offset hour to appear
> properly.

Right.  There appears to be a rather nasty bug in DateDiff().  If you put
the
larger value first, it sort of loses its mind, as evidenced by your code.
Even
more interesting is to replace the "h" argument with "n" to get the
difference
in minutes, then divide by 60 to get hours.  The difference with the smaller
value in the first argument is 8; the difference with the larger value in
the
first argument is -7.98333333333.  Naturally, taking the hour part of this
failed calculation gives you the erroneous -7.  Anyway, on to a solution.

What you really want to do (it seems to me) is take the hour part of the
local
datetime and compare that to the hour part of the server's datetime,
ignoring
the minutes.  So:

<cfscript>
  utcHour = Hour("3/30/2001 12:00:00");
  localHour = Hour("3/30/2001 4:00:00");
  UserTZOffset = localHour-utcHour;
</cfscript>
<CFOUTPUT>
 User's TimeZoneOffset = #UserTZOffset#
</CFOUTPUT>

Of course, you'll still have to deal with that handful of countries who have
partial-hour offsets.

- Jeff

==============================================================
| Jeffrey S. Peters       | "Specialization is for insects." |
| [EMAIL PROTECTED]    |                 - Lazarus Long   |
| PGP key for Jeffrey S. Peters at ldap://keyserver.pgp.com  |
==============================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to