RE: DateAdd value different on different servers

2010-04-22 Thread DURETTE, STEVEN J (ATTASIAIT)

I believe it is doing this because even though you are adding a specific
amount of seconds the system automatically knows to make adjustments
based on its time zone or if it uses daylight savings time or not.  So
even though you say ignore that, you can't because the system doesn't
ignore it.

Steve


-Original Message-
From: Tom McNeer [mailto:tmcn...@gmail.com] 
Sent: Wednesday, April 21, 2010 5:13 PM
To: cf-talk
Subject: Re: DateAdd value different on different servers


Thanks for the replies, but mainly they tell me that I've muddied the
water.

Let me try to be clearer:

I shouldn't have even mentioned the Unix value, because that's not
relevant.
Just forget that I'm getting a Unix value completely.

And I definitely should not have shown the time zones, because they
shouldn't be relevant.

So let me start over. Forget everything but the following:

First, I'm saying, Create a date/time value for January 1, 1970.

myDate = createDate(1970,1,1)

That's going to result in an object that represents midnight on
1/1/1970.
Doesn't even matter that it's the epoch date.

Then I'm adding a number of seconds:

myDate2 = DateAdd('s',1271779666,myDate)

When these two values are dumped, two servers show the following:

{ts '1970-01-01 00:00:00'}

 {ts '2010-04-20 17:07:46'}

One server shows this:

{ts '1970-01-01 00:00:00'}

 {ts '2010-04-20 16:07:46'}
=

So - we're not dealing with time zones. We're simply creating date/time
values. Why does the result of the dateAdd function return different
values?

That's the real issue. Sorry for being so confusing before.


-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560




~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333082
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-22 Thread Tom McNeer

Steve,

On Thu, Apr 22, 2010 at 8:47 AM, DURETTE, STEVEN J (ATTASIAIT) 
sd1...@att.com wrote:


 I believe it is doing this because even though you are adding a specific
 amount of seconds the system automatically knows to make adjustments
 based on its time zone or if it uses daylight savings time or not.


If dateAdd worked that way, you'd have to adjust for the server time zone
constantly. It doesn't. It's just math.

I can confirm that two servers, both running CF9 on Windows Server 2008,
both in the Eastern time zone, both recognizing that Daylight Savings Time
is in effect, are returning date/time values one hour apart.

Moreover, I can confirm that a server in the Central time zone, also
recognizing that Daylight Savings Time is in effect, returns a date/time
value that is the same as one of the EDT servers, and one hour _later_ (not
earlier) than one of the EDT servers.

After I've played with the JVMs, I'll report back.



-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333083
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: DateAdd value different on different servers

2010-04-22 Thread DURETTE, STEVEN J (ATTASIAIT)

Yes I agree that it is just math, it is the output that is doing the
conversion.  The computers should be using Universal Time (Used to be
Greenwich Mean Time), but whenever you display a time it converts to the
local time zone. I know there is a way to display it in Universal time,
but I don't remember how at the moment.

Or maybe I missed something, but the fact that it is exactly one hour
off just screams time zone/daylight savings time difference.

Steve

-Original Message-
From: Tom McNeer [mailto:tmcn...@gmail.com] 
Sent: Thursday, April 22, 2010 9:17 AM
To: cf-talk
Subject: Re: DateAdd value different on different servers


Steve,

On Thu, Apr 22, 2010 at 8:47 AM, DURETTE, STEVEN J (ATTASIAIT) 
sd1...@att.com wrote:


 I believe it is doing this because even though you are adding a
specific
 amount of seconds the system automatically knows to make adjustments
 based on its time zone or if it uses daylight savings time or not.


If dateAdd worked that way, you'd have to adjust for the server time
zone
constantly. It doesn't. It's just math.

I can confirm that two servers, both running CF9 on Windows Server 2008,
both in the Eastern time zone, both recognizing that Daylight Savings
Time
is in effect, are returning date/time values one hour apart.

Moreover, I can confirm that a server in the Central time zone, also
recognizing that Daylight Savings Time is in effect, returns a date/time
value that is the same as one of the EDT servers, and one hour _later_
(not
earlier) than one of the EDT servers.

After I've played with the JVMs, I'll report back.



-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560




~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333084
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-22 Thread Tom McNeer

Okay,

So - it wasn't a JVM issue. Updating it did not change the results.

And Steve was right, in a way. But I still don't understand why it should be
this way.

First, Steve, I understand what you're saying about whenever you display a
time. But in practice, I'm not displaying a time at all. I'm simply
creating a date/time value and adding a number of seconds to it, then
inserting into a database.

So to my way of thinking - and according to every doc I've ever read - the
dateAdd function should do exactly what you tell it to do: just add the
increments to the original date.

But what's happening DOES involve DST - though not the time zone. I don't
know why. It shouldn't. But it does, at least in CF9.

Try this for yourself: Daylight Savings Time began at 2:00 AM Eastern on
March 14, 2010. So run the following:

cfset myDate = createDate(2010,3,14) /
cfdump var=#myDate# /brbr
cfset myDate2 = DateAdd('s',1271779666,myDate)
cfdump var=#myDate2# /brbr

myDate is two hours _before_ DST went into effect. On two different CF9
servers, one on EDT, the other on CDT, the result for myDate2 was:
{ts '2050-07-01 17:07:46'}

Now change the createDate to (2010,3,15) - _after_ DST went into effect. On
the same servers, the result was:
{ts '2050-07-02 16:07:46'}

The original date was changed by a day. But the result of the dateAdd
statement changed by 23 hours.

I wish I could test this on CF8 and/or 7, but the only servers with those
versions to which I have access are in Arizona, where they don't use DST.
Those servers return the 16:07:46 timestamp. But without having the machines
set to DST, I can't tell if CF is acting differently or not.

If someone has access to those versions on a DST machine, please try this
and see what you get. I'd really be curious to know if this is a CF9 thing.

Maybe I've just misunderstood how dateAdd works - although the docs simply
say Adds units of time to a date. There's no mention of DST affecting it.
But it's certainly doing so.

So in brief: when you dateAdd, the result will be affected by DST  - at
least, based on whether your added timespan crosses the DST threshhold for
the current year. I have no idea if it tries to figure out whether the
resulting date/time is during DST or not.

In most instances, this might not even be noticed. But in my case, where I'm
receiving a timestamp from an external device as a Unix epoch time, then
converting it to a date/time object by adding the epoch time to the date of
1/1/1970, the result is not what I want, since all I'm trying to do is
recreate the time from the original device. The DST addition causes the
timestamp to be wrong by an hour.

Frustrating, but at least I now understand what's happening. Hope this will
help someone else avoid the same frustration.



-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333085
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-22 Thread Judah McAuley

The issue has come up before on the list and here is the reasoning:

Take 5 a.m. on the day before DST kicks in. Then 5 a.m. on the day
that DST kicks in. Logically, you'd think that one day had elapsed.
Well, that's true if you are using a day as your unit of measurement,
but that isn't how Java does it. Ask yourself this question: how many
hours elapsed? Well, 5 a.m. on the first day until 2 a.m. on the next
day is 21 hours. But then the clocks jump forward to 3 a.m. The hour
between 2 and 3 a.m. never happens, it disappears. Then it counts from
3 a.m. to 5 a.m. which is another 2 hours. So 21 + 2 = 23 hours, not
24.  Down in the JVM, it is actually counting in milliseconds, not
hours, so the hour that is missing is actually 3,600,000 milliseconds,
but the principle is the same. When you ask Java how many days have
elapsed from 5 am this day to 5 am the following day and that spans
the time change, Java is going to reply 0 because a whole day has not
elapsed.

In your particular example, you have servers in two places, one that
observes daylight savings and one which does not. The difference you
are seeing is a result of that. Going back to my previous example,
lets take the server on the East Coast (that observes daylight
savings) and add 24 hours to the 5 a.m. time the day before the time
change. Internally, it adds 21 hours, hits 2 a.m. (when the time shift
happens and it is suddenly 3 a.m.), then adds 3 hours to 3 a.m. giving
you 6 a.m.

The same example in Arizona, where they don't observe daylight
savings: it adds 21 hours to get to 2 a.m., no time shift happens
because of daylight savings, so it then adds the other 3 hours and
gets 2 a.m. + 3 hours = 5 a.m.

Hence, adding the same number of time units to the same starting time
ends up producing two different resulting time values because one
server skips over a lost hour during the dst transition.

Confusing as hell, but internally consistent at least.

Cheers,
Judah

On Thu, Apr 22, 2010 at 9:35 AM, Tom McNeer tmcn...@gmail.com wrote:

 Okay,

 So - it wasn't a JVM issue. Updating it did not change the results.

 And Steve was right, in a way. But I still don't understand why it should be
 this way.

 First, Steve, I understand what you're saying about whenever you display a
 time. But in practice, I'm not displaying a time at all. I'm simply
 creating a date/time value and adding a number of seconds to it, then
 inserting into a database.

 So to my way of thinking - and according to every doc I've ever read - the
 dateAdd function should do exactly what you tell it to do: just add the
 increments to the original date.

 But what's happening DOES involve DST - though not the time zone. I don't
 know why. It shouldn't. But it does, at least in CF9.

 Try this for yourself: Daylight Savings Time began at 2:00 AM Eastern on
 March 14, 2010. So run the following:

    cfset myDate = createDate(2010,3,14) /
    cfdump var=#myDate# /brbr
    cfset myDate2 = DateAdd('s',1271779666,myDate)
    cfdump var=#myDate2# /brbr

 myDate is two hours _before_ DST went into effect. On two different CF9
 servers, one on EDT, the other on CDT, the result for myDate2 was:
 {ts '2050-07-01 17:07:46'}

 Now change the createDate to (2010,3,15) - _after_ DST went into effect. On
 the same servers, the result was:
 {ts '2050-07-02 16:07:46'}

 The original date was changed by a day. But the result of the dateAdd
 statement changed by 23 hours.

 I wish I could test this on CF8 and/or 7, but the only servers with those
 versions to which I have access are in Arizona, where they don't use DST.
 Those servers return the 16:07:46 timestamp. But without having the machines
 set to DST, I can't tell if CF is acting differently or not.

 If someone has access to those versions on a DST machine, please try this
 and see what you get. I'd really be curious to know if this is a CF9 thing.

 Maybe I've just misunderstood how dateAdd works - although the docs simply
 say Adds units of time to a date. There's no mention of DST affecting it.
 But it's certainly doing so.

 So in brief: when you dateAdd, the result will be affected by DST  - at
 least, based on whether your added timespan crosses the DST threshhold for
 the current year. I have no idea if it tries to figure out whether the
 resulting date/time is during DST or not.

 In most instances, this might not even be noticed. But in my case, where I'm
 receiving a timestamp from an external device as a Unix epoch time, then
 converting it to a date/time object by adding the epoch time to the date of
 1/1/1970, the result is not what I want, since all I'm trying to do is
 recreate the time from the original device. The DST addition causes the
 timestamp to be wrong by an hour.

 Frustrating, but at least I now understand what's happening. Hope this will
 help someone else avoid the same frustration.



 --
 Thanks,

 Tom

 Tom McNeer
 MediumCool
 http://www.mediumcool.com
 1735 Johnson Road NE
 Atlanta, GA 30306
 404.589.0560

Re: DateAdd value different on different servers

2010-04-22 Thread Tom McNeer

Hi Judah,

Yep. I understand. And the consistency is there. I just didn't know that
dateAdd made the adjustment, though I knew Java knew the difference.

And though it may have been discussed earlier on the list, I sure couldn't
find it in all the Googling I did before I posted.

Anyway, now that I understand what's happening, it's an easy workaround:
getTimeZoneInfo().isDSTon.


-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333088
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-22 Thread Judah McAuley

I'm planning on using timezone.cfc for a lot of my calendar-related
functionality in the future due to these issues:

http://timezonecfc.riaforge.org/

Cheers,
Judah

On Thu, Apr 22, 2010 at 10:26 AM, Tom McNeer tmcn...@gmail.com wrote:

 Hi Judah,

 Yep. I understand. And the consistency is there. I just didn't know that
 dateAdd made the adjustment, though I knew Java knew the difference.

 And though it may have been discussed earlier on the list, I sure couldn't
 find it in all the Googling I did before I posted.

 Anyway, now that I understand what's happening, it's an easy workaround:
 getTimeZoneInfo().isDSTon.


 --
 Thanks,

 Tom

 Tom McNeer
 MediumCool
 http://www.mediumcool.com
 1735 Johnson Road NE
 Atlanta, GA 30306
 404.589.0560


 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333089
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-22 Thread Tom McNeer

On Thu, Apr 22, 2010 at 1:37 PM, Judah McAuley ju...@wiredotter.com wrote:


 I'm planning on using timezone.cfc for a lot of my calendar-related
 functionality in the future due to these issues:


It's an excellent resource. I use it a good bit. But as I say, I just wasn't
aware of this particular issue, though your explanation makes perfect sense.


-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333090
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers [spamtrap heur]

2010-04-22 Thread Paul Hastings

 I'm planning on using timezone.cfc for a lot of my calendar-related
 functionality in the future due to these issues:

 http://timezonecfc.riaforge.org/

you might want this one instead (i think it's a bit newer). i forget why 
somebody else pushed that up there but anyway:

http://www.sustainablegis.com/projects/tz/testTZCFC.cfm



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333091
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-22 Thread Roger Austin

In CF8

cfset myDate = createDate(2010,3,14) /
cfdump var=#myDate# /br /
UTCcfdump var=#GetHttpTimeString(myDate)# /br /br /

cfset myDate2 = DateAdd('s',1271779666,myDate) /
cfdump var=#myDate2# /br /
UTCcfdump var=#GetHttpTimeString(myDate2)# /br /br /

cfset myDate = createDate(2010,3,15) /
cfdump var=#myDate# /br /
UTCcfdump var=#GetHttpTimeString(myDate)# /br /br /

cfset myDate2 = DateAdd('s',1271779666,myDate) /
cfdump var=#myDate2# /br /
UTCcfdump var=#GetHttpTimeString(myDate2)# /br /br /

Output was:

{ts '2010-03-14 00:00:00'}
UTC Sun, 14 Mar 2010 05:00:00 GMT

{ts '2050-07-01 17:07:46'}
UTC Fri, 01 Jul 2050 21:07:46 GMT

{ts '2010-03-15 00:00:00'}
UTC Mon, 15 Mar 2010 04:00:00 GMT

{ts '2050-07-02 16:07:46'}
UTC Sat, 02 Jul 2050 20:07:46 GMT 

 Tom McNeer tmcn...@gmail.com wrote: 
 
 Okay,
 
 So - it wasn't a JVM issue. Updating it did not change the results.
 
 And Steve was right, in a way. But I still don't understand why it should be
 this way.
 
 First, Steve, I understand what you're saying about whenever you display a
 time. But in practice, I'm not displaying a time at all. I'm simply
 creating a date/time value and adding a number of seconds to it, then
 inserting into a database.
 
 So to my way of thinking - and according to every doc I've ever read - the
 dateAdd function should do exactly what you tell it to do: just add the
 increments to the original date.
 
 But what's happening DOES involve DST - though not the time zone. I don't
 know why. It shouldn't. But it does, at least in CF9.
 
 Try this for yourself: Daylight Savings Time began at 2:00 AM Eastern on
 March 14, 2010. So run the following:
 
 cfset myDate = createDate(2010,3,14) /
 cfdump var=#myDate# /brbr
 cfset myDate2 = DateAdd('s',1271779666,myDate)
 cfdump var=#myDate2# /brbr
 
 myDate is two hours _before_ DST went into effect. On two different CF9
 servers, one on EDT, the other on CDT, the result for myDate2 was:
 {ts '2050-07-01 17:07:46'}
 
 Now change the createDate to (2010,3,15) - _after_ DST went into effect. On
 the same servers, the result was:
 {ts '2050-07-02 16:07:46'}
 
 The original date was changed by a day. But the result of the dateAdd
 statement changed by 23 hours.
 
 I wish I could test this on CF8 and/or 7, but the only servers with those
 versions to which I have access are in Arizona, where they don't use DST.
 Those servers return the 16:07:46 timestamp. But without having the machines
 set to DST, I can't tell if CF is acting differently or not.


--
http://www.linkedin.com/pub/roger-austin/8/a4/60
http://twitter.com/RogerTheGeek
http://www.misshunt.com/ Home of the Clean/Dirty Magnet
http://www.ncdevcon.com/ TACFUG 2010 Conference in North Carolina


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333092
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


DateAdd value different on different servers

2010-04-21 Thread Tom McNeer

There's a simple answer to this one; it's just beyond me.

I have a routine that takes a Unix time value which is passed from an
external device and creates a date/time object. A client complained that the
time being generated was an hour off. He's right. But I can't figure out
why.

As a test, I ran the following code on three different servers, all running
CF 9:

-
cfset myDate = DateAdd('s',1271779666,createDate(1970,1,1))
cfoutput #dateFormat(myDate,'long')# -
#timeformat(myDate,'long')#/cfoutput


The results:

Server 1 - Dev server, Eastern Time Zone
April 20, 2010 - 4:07:46 PM GMT

Server 2 - Production server, Eastern Time Zone
April 20, 2010 - 5:07:46 PM EDT

Server 3 - Production server, Central Time Zone
April 20, 2010 - 5:07:46 PM CDT

So why are the latter two servers inserting time zone information, and why
are they advancing the time an hour?

-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333065
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: DateAdd value different on different servers

2010-04-21 Thread DURETTE, STEVEN J (ATTASIAIT)

Looks like one of the servers updated to DST and the others didn't.

Steve


-Original Message-
From: Tom McNeer [mailto:tmcn...@gmail.com] 
Sent: Wednesday, April 21, 2010 1:55 PM
To: cf-talk
Subject: DateAdd value different on different servers


There's a simple answer to this one; it's just beyond me.

I have a routine that takes a Unix time value which is passed from an
external device and creates a date/time object. A client complained that
the
time being generated was an hour off. He's right. But I can't figure out
why.

As a test, I ran the following code on three different servers, all
running
CF 9:

-
cfset myDate = DateAdd('s',1271779666,createDate(1970,1,1))
cfoutput #dateFormat(myDate,'long')# -
#timeformat(myDate,'long')#/cfoutput


The results:

Server 1 - Dev server, Eastern Time Zone
April 20, 2010 - 4:07:46 PM GMT

Server 2 - Production server, Eastern Time Zone
April 20, 2010 - 5:07:46 PM EDT

Server 3 - Production server, Central Time Zone
April 20, 2010 - 5:07:46 PM CDT

So why are the latter two servers inserting time zone information, and
why
are they advancing the time an hour?

-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560




~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333067
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-21 Thread Judah McAuley

Two quick things:

1) those times aren't an hour off. EDT should be 4 hours off of UTC
(GMT) and you are showing it as 1 hour, so that is actually a
discrepancy of 3 hours.

2) Java uses its own date/time/timezone system that is independent of
the underlying OS. You can directly invoke the OS date bits in Java, I
believe, but it doesn't work that way by default. So if you got one
datetime from the OS (your Unix time value from the external device)
and one value from CF (which uses Java) and the two don't match up,
you might have the Java calendar settings messed up. Possibilities
include: old version of java with incorrect timezone information and
an incorrect Locale setting for Java.

Hope that helps your investigation.

Cheers,
Judah

On Wed, Apr 21, 2010 at 10:55 AM, Tom McNeer tmcn...@gmail.com wrote:

 There's a simple answer to this one; it's just beyond me.

 I have a routine that takes a Unix time value which is passed from an
 external device and creates a date/time object. A client complained that the
 time being generated was an hour off. He's right. But I can't figure out
 why.

 As a test, I ran the following code on three different servers, all running
 CF 9:

 -
    cfset myDate = DateAdd('s',1271779666,createDate(1970,1,1))
    cfoutput #dateFormat(myDate,'long')# -
 #timeformat(myDate,'long')#/cfoutput
 

 The results:

 Server 1 - Dev server, Eastern Time Zone
 April 20, 2010 - 4:07:46 PM GMT

 Server 2 - Production server, Eastern Time Zone
 April 20, 2010 - 5:07:46 PM EDT

 Server 3 - Production server, Central Time Zone
 April 20, 2010 - 5:07:46 PM CDT

 So why are the latter two servers inserting time zone information, and why
 are they advancing the time an hour?

 --
 Thanks,

 Tom

 Tom McNeer
 MediumCool
 http://www.mediumcool.com
 1735 Johnson Road NE
 Atlanta, GA 30306
 404.589.0560


 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333068
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-21 Thread Tom McNeer

Thanks for the replies, but mainly they tell me that I've muddied the water.

Let me try to be clearer:

I shouldn't have even mentioned the Unix value, because that's not relevant.
Just forget that I'm getting a Unix value completely.

And I definitely should not have shown the time zones, because they
shouldn't be relevant.

So let me start over. Forget everything but the following:

First, I'm saying, Create a date/time value for January 1, 1970.

myDate = createDate(1970,1,1)

That's going to result in an object that represents midnight on 1/1/1970.
Doesn't even matter that it's the epoch date.

Then I'm adding a number of seconds:

myDate2 = DateAdd('s',1271779666,myDate)

When these two values are dumped, two servers show the following:

{ts '1970-01-01 00:00:00'}

 {ts '2010-04-20 17:07:46'}

One server shows this:

{ts '1970-01-01 00:00:00'}

 {ts '2010-04-20 16:07:46'}
=

So - we're not dealing with time zones. We're simply creating date/time
values. Why does the result of the dateAdd function return different values?

That's the real issue. Sorry for being so confusing before.


-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333069
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-21 Thread Jason Fisher

I'd say that earns a WTF.  It would appear that one of the servers must 
be adjusting the original CreateDate(), but your output shows that it's 
just not happening that way.  I always thought that the DateAdd() was a 
simple math function.  What are the differences (if any) in JVM and CF 
versions?

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333071
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-21 Thread Tom McNeer

On Wed, Apr 21, 2010 at 5:32 PM, Jason Fisher ja...@wanax.com wrote:


 I'd say that earns a WTF.


I'd agree.


  It would appear that one of the servers must
 be adjusting the original CreateDate(), but your output shows that it's
 just not happening that way.


And in the real world, the _one_ server that's different is actually
correct. By that I mean, in my application, the external devices (many of
them) are sending in the seconds value as a Unix epoch value. And the
_one_ server that's different is the one where the final date/time value
matches what the users are inputting on the external devices.


  I always thought that the DateAdd() was a
 simple math function.


Me, too.


  What are the differences (if any) in JVM and CF
 versions?


CF versions are the same:  9.0.0.251028 - Standard

One of the wrong servers is using the JVM installed by default with CF 9.
The other wrong server is using 1.6.0_17.
The right server is using 1.6.0_18.

I'll update the JVM on one of the wrong servers in the morning and see
what that does.


-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333073
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers

2010-04-21 Thread Jason Fisher

Wow.  Post back after you update.  I can't image that there's any real 
difference between 6.17 and 6.18, but if there is, I'll gladly update 
all of our servers NOW!  :)

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333075
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: DateAdd value different on different servers [spamtrap bayes][spamtrap heur]

2010-04-21 Thread Paul Hastings

On 4/22/2010 4:13 AM, Tom McNeer wrote:
 So - we're not dealing with time zones. We're simply creating date/time

no, you're *always* dealing with tz when it comes to cf datetimes. cf will 
always use the server's tz for all datetime operations. dump out the java epoch 
for both server's

cfscript
javaEpoch=createDateTime(1970,1,1,0,0,0);
myDate=dateAdd('s',1271779666,javaEpoch);
writeoutput(#myDate# ::: #myDate.getTime()#); 
/cfscript

are they the same?

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333079
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm