Avatar of Eric Bourland
Eric Bourland
Flag for United States of America asked on

coldfusion server time / date reporting

Windows 2008 Server R2
ColdFusion 9

I need to know what time ColdFusion thinks it is. I use this:

 <cfoutput>#DateFormat(Now())#,
    #TimeFormat(Now())#</cfoutput>

And you can see the output here: http://nnvawi.org/datetime.cfm

That is strange, though. I have set my Windows 2008 Server R2 to UTC time -- or, GMT. According to Windows, the current time is 7:51 p.m.

However, ColdFusion thinks the time is 12:51 p.m.

I think I need ColdFusion to report a time of 7:51p.m., just as Windows Server does.

(I need to do this because my authorize.net application throws an error:

(97) This transaction cannot be accepted.

Which seems to indicate that authorize.net does not accept the timestamp provided by ColdFusion.)

Why do you think Coldfusion says the time is 12:51p.m.? Does ColdFusion derive its timestamp for function TimeFormat(Now()) from the server?

Thanks as always for your help.

Eric
ColdFusion Language

Avatar of undefined
Last Comment
_agx_

8/22/2022 - Mon
_agx_

> from the server?

Yes and no.  CF gets the time from the JVM. The JVM time is based on the server o/s, but it can be changed to use a different timezone. For example, some hosts add JVM arguments to change the time zone to GMT/UTC, so everyone is using the same time.

                 -Duser.timezone=GMT

That means if you are on the East Coast, the time returned by now() will several hours ahead of what you were expecting.  I don't know if you have access to createObject("java"). If not, try dumping the TZ information:

       <cfdump var="#GetTimeZoneInfo()#">
Randy Johnson

_agx_

Haha, I just searched for that old thread  and couldn't find it. You'd think I'd be able to find my own posts ;-)  Anyway, I wasn't sure if Eric has createObject() access. If not, GetTimeZoneInfo() is a quick and easy way to determine if the server is using UTC time.  For the details, you'd need java though.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
_agx_

> (97) This transaction cannot be accepted.

Out of curiosity, what made you conclude the date was the cause? It's certainly possible, of course, but that message sounds rather generic.

EDIT: Never mind, I found a link from 2011 which mentions code 97 means a date problem:

Error 97s occur when we receive an invalid timestamp from your Web server. Your Web server would use its clock to generate a timestamp which is used to generate a fingerprint hash for security reasons. When your script submits a transaction to us, the fingerprint hash and the timestamp are sent to us. If the timestamp is either fifteen minutes ahead or fifteen minutes behind the current time in Greenwich Mean Time (GMT)--also called Coordinated Universal Time (UTC)--this error would occur.
Eric Bourland

ASKER
Here's an update.

1) thank you for these very helpful comments. =)

2) after a lot of research, and a phone conversation with authorize.net tech support, and tearing out what little hair I have left, I am pretty sure that the (97) error is caused because my JVM timestamp is 13-Aug-14, 01:49 PM ; but, the UTC time is 13-Aug-14, 08:49 PM.

3) This gives me two options: change the time in JVM to UTC time; or, do something in my code to add seven hours to the timestamp of the transaction.

How difficult is it to change the time in the JVM?

Or, should I work with the (fairly simple) ColdFusion code (see below) to send a timestamp with +7 hours?

Thanks again. =)

Eric

<cfsetting enablecfoutputonly="true">
<cfoutput>
<!--
This sample code is designed to connect to Authorize.net using the SIM method.
For API documentation or additional sample code, please visit:
http://developer.authorize.net

Most of this page below (and including) this comment can be modified using any
standard html. The parts of the page that cannot be modified are noted in the
comments.  This file can be renamed as long as the file extension remains .cfm
-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
  "http://www.w3.org/TR/html4/loose.dtd">
<HTML lang='en'>
<HEAD>
	<TITLE> Sample SIM Implementation </TITLE>
</HEAD>
<BODY>


<!-- This section generates the "Submit Payment" button using Coldfusion     -->
</cfoutput>
<!--- the parameters for the payment can be configured here --->
<!--- the API Login ID and Transaction Key must be replaced with valid values --->
<cfset loginID="xxxx">
<cfset transactionKey="xxxx">
<cfset amount="19.99">
<cfset description="Sample Transaction">
<cfset label="Submit Payment"> <!--- This is the label on the 'submit' button --->
<cfset testMode="false">


<cfset posturl="https://secure.authorize.net/gateway/transact.dll">

<!--- If an amount or description were posted to this page, the defaults are overidden --->
<cfif IsDefined("FORM.amount")>
  <cfset amount=FORM.amount>
</cfif>
<cfif IsDefined("FORM.description")>
  <cfset description=FORM.description>
</cfif>
<!--- also check to see if the amount or description were sent using the GET method --->
<cfif IsDefined("URL.amount")>
  <cfset amount=URL.amount>
</cfif>
<cfif IsDefined("URL.description")>
  <cfset description=URL.description>
</cfif>

<!--- an invoice is generated using the date and time --->
<cfset invoice=DateFormat(Now(),"yyyymmdd") & TimeFormat(Now(),"HHmmss")>

<!--- a sequence number is randomly generated --->
<cfset sequence=RandRange(1, 1000)>

<!--- a timestamp is generated --->
<cfset timestamp=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now())) >

<!--- The following lines generate the SIM fingerprint --->

<cf_hmac data="#loginID#^#sequence#^#timestamp#^#amount#^" key="#transactionKey#">

<cfset fingerprint=#digest#>

<cfoutput>

<!--- Print the Amount and Description to the screen.--->
Amount: #amount# <br />
Description: #description# <br />

<!--- Create the HTML form containing necessary SIM post values --->
<FORM method='post' action='#posturl#' >
<!--- Additional fields can be added here as outlined in the SIM integration
guide at http://developer.authorize.net --->
<INPUT type='hidden' name='x_login' value='#loginID#' />
	<INPUT type='hidden' name='x_amount' value='#amount#' />
	<INPUT type='hidden' name='x_description' value='#description#' />
	<INPUT type='hidden' name='x_invoice_num' value='#invoice#' />
	<INPUT type='hidden' name='x_fp_sequence' value='#sequence#' />
	<INPUT type='hidden' name='x_fp_timestamp' value='#timeStamp#' />
	<INPUT type='hidden' name='x_fp_hash' value='#fingerprint#' />
	<INPUT type='hidden' name='x_test_request' value='#testMode#' />
	<INPUT type='hidden' name='x_show_form' value='PAYMENT_FORM' />
	<input type='submit' value='#label#' />
</FORM>
<!-- This is the end of the code generating the "submit payment" button.    -->

</BODY>
</HTML>
<!-- The last line is a necessary part of the coldfusion script -->
</cfoutput>

Open in new window

_agx_

EDIT:

If it's *your* server that's off from UTC, you may be in luck. You should be able to use DateConvert to convert your local server time ie now() into UTC:

     <cfset timestamp = dateConvert( now(), "local2Utc")>

> I am pretty sure that the (97) error is caused because my JVM timestamp

Agreed.  I searched a bit after posting that comment and found a link which also confirmed 97 means the timestamp is off from what they were expecting. See updates
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

> How difficult is it to change the time in the JVM?

In this case try using dateConvert() first. It's the simpler option.

But to answer your question, as long as it's not a shared server, then it's not difficult. In short, you change the timezone setting in either the CF Admin OR the jvm.config file. Then restart CF.  My preference is using jvm.config.

Note: It's a global setting, so it will affect ALL applications running in that JVM

Here's a summary from an old thread

The best way is to edit your jvm.config file add it to the jvm arguments section.  Make a backup copy first! For single server installs the file's located: C:\ColdFusion9\runtime\bin\jvm.config). Save the settings and restart CF.

# Arguments to VM
java.args=-server -Xmx512m -Duser.timezone="your tz ID goes here"  ... other settings

Open in new window


http://forums.adobe.com/thread/552963?tstart=0
Eric Bourland

ASKER
Got it. Makes sense. I am going to back up, then edit the JVM.config file; restart ColdFusion; and see if that fixes the authorize.net (97) problem.

I will have to do this tomorrow because my ISP (Viviotech.net) is applying a number of patches to my server right now; and, I have to go cook dinner and tidy the house. =)

I'll report my discoveries tomorrow. As always, thanks, _agx_.

E
_agx_

EDIT:

Eric - Actually I recommend trying DateConvert() first.  It's much simpler. From what you described, it should do the trick. If not, you can always modify the JVM settings. Just note the important caveats:

- ALWAYS make a backup of jvm.config first. A bad jvm.config file can prevent the CF server from starting. As long as you have a backup, just restore it and you're good to go.

- Changing the timezone affects ALL apps sharing that JVM
Your help has saved me hundreds of hours of internet surfing.
fblack61
Eric Bourland

ASKER
I tried DateConvert(). I got this error at first:

 Parameter validation error for the DATECONVERT function.
The value of parameter 2, which is currently local2Utc, must be a class java.util.Date value.

So I changed the parameters to this: <cfset timestamp = dateConvert("local2Utc", now() )>

and that removed the error. But I am still getting the "(97) This transaction cannot be accepted." from authorize.net, which means (according to them) that my server is still outputting a Pacific Time timestamp.

A look at my timestamp test page: http://nnvawi.org/datetime.cfm

confirms this.

I am a little nervous about changing the JVM config file.

Am I using the DateConvert() function correctly?

<!--- an invoice is generated using the date and time --->
<cfset invoice=DateFormat(Now(),"yyyymmdd") & TimeFormat(Now(),"HHmmss")>

<!--- a sequence number is randomly generated --->
<cfset sequence=RandRange(1, 1000)>

<!--- a timestamp is generated --->

<!--- old cfset timestamp --->
<!---<cfset timestamp=DateDiff("s", "January 1 1970 07:00", DateConvert('local2UTC', Now())) >--->

<!--- new cfset timestamp, per _agx_ --->
<cfset timestamp = dateConvert("local2Utc", now() )>

<!--- The following lines generate the SIM fingerprint --->

<cf_hmac data="#loginID#^#sequence#^#timestamp#^#amount#^" key="#transactionKey#">

<cfset fingerprint=#digest#>

Open in new window


Hope you have a great evening. Thanks as always.

Eric
_agx_

which means (according to them) that my server is still outputting a Pacific Time timestamp

Well specifically, it means that the time sent is off by more than +/- 15 minutes than what authorize.net expected. At least according to what I read.

EDIT:
EE was down last night when I went to reply. However, when I ran the test page, the displayed date and time was off by +5 hours. At that point, it was around 3:00 AM GMT. But the test page displayed something like 8:00 AM.  Right now the test page seems to be displaying Eastern time, ie GMT -4 hours

Can you run the following and post the results?

<cfoutput>
  now #now()#<br>
  gmt #dateConvert("local2utc", now())#<br>
</cfoutput>     

<cfset prop =createObject('java', 'java.lang.System').getProperties()>
<cfdump var="user.timezone = #prop['user.timezone']#">	
<cfdump var="#GetTimeZoneInfo()#">

Open in new window

Eric Bourland

ASKER
Good morning!

I ran the test here: http://nnvawi.org/timezone.cfm

But, I should report a few notes:

1. my server is in Walla Walla Washington, at Viviotech.
2. the server clock is set to the UTC timezone -- GMT
3. total UTC offset should be seven hours

>>>Well specifically, it means that the time sent is off by more than +/- 15 minutes than what authorize.net expected. At least according to what I read.

I agree.

I also agree about the odd behavior of my datetime test http://nnvawi.org/datetime.cfm

datetime.cfm is simply this: <cfoutput>#DateFormat(Now())#, #TimeFormat(Now())#</cfoutput>

I wonder why datetime.cfm reports Eastern Standard Time? That's my current timezone; I am in DC. But I thought the Now() function reported the time on the server?

Thanks again for your help with managing time. =)

Eric
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

I still think this can be done with DateConvert, but wanted to comment on this:

> I am a little nervous about changing the JVM config file

Once you've done it a few times, you'll see it's not really a big deal.  It basically amounts to changing a text file ;-) BUT ... I completely understand your caution. I always try stuff like that locally first, with the CF developer version. That way I can see the results and get comfortable with it.  

It can also be changed via the CF Admin: Server Settings > Java and JVM > Java Arguments. The end result is the same. You're just making jvm.config modifications through a web interface instead of notepad. Though I'd still recommend making a  backup first. "Better safe than sorry" and all that ;-)
_agx_

>> managing time. =)

Haha. Wish we could do the same in real life. "Don't have enough time? Run this simple CF code to instantly add or subtract time from your day!"


>> 1. my server is in Walla Walla Washington, at Viviotech.
>> 2. the server clock is set to the UTC timezone -- GMT

Okay

>> 3. total UTC offset should be seven hours

Not necessarily. The offset will only be 7 hours IF the JVM on that server (not the o/s) is set to use the "Pacific" time zone. Remember you can set the JVM time zone to be anything you want. So it may not using the "Pacific" time zone.


>> I wonder why datetime.cfm reports Eastern Standard Time? That's my current timezone; I am in DC.
>> But I thought the Now() function reported the time on the server?

Not exactly. It reports the current time on the server, but .... adjusted for whatever timezone is set by the JVM.  Based on the results, I'd say the JVM is set to use "Eastern", not "Pacific".  


>> I ran the test here: http://nnvawi.org/timezone.cfm
>> now {ts '2014-08-14 11:36:58'}
>> user.timezone = America/New_York


Yep.  The dumps confirm it's set to the "Eastern" time zone and that DateConvert is working correctly:

       gmt {ts '2014-08-14 15:36:58'}

That's the current time in GMT. I'm not sure why you're still getting the 97 error, if this is how you're generating the value:

     <cfset timestamp = dateConvert("local2Utc", now() )>

Are you positive you're not accidentally using #now()# somewhere else instead of #timestamp#?
Eric Bourland

ASKER
Hmmm.

I give the full code of the test page -- test.cfm -- below.

The test page is set up here: http://nnvawi.org/test.cfm

So, here is what (I think) we know:

1) DateConvert is working correctly
2) Web server (Windows 2008 R2) is set to UTC / GMT time -- not eastern time, not Pacific time -- but this does not matter too much
3) JVM is apparently set to EST -- correct?
4) the (97) error persists and authorize.net chortles at my failure ;-)

>>>Not necessarily. The offset will only be 7 hours IF the JVM on that server (not the o/s) is set to use the "Pacific" time zone. Remember you can change the JVM time zone to be anything you want. So it may not using the "Pacific" time zone.

Got it. This makes sense.

I do not think the Now() function appears elsewhere ... wait. On line 52:

<!--- an invoice is generated using the date and time --->
<cfset invoice=DateFormat(Now(),"yyyymmdd") & TimeFormat(Now(),"HHmmss")>

Could that be the problem?

Thanks again! This is an interesting problem. (In a way.) =)

Eric




<cfsetting enablecfoutputonly="true">
<cfoutput>
<!--
This sample code is designed to connect to Authorize.net using the SIM method.
For API documentation or additional sample code, please visit:
http://developer.authorize.net

Most of this page below (and including) this comment can be modified using any
standard html. The parts of the page that cannot be modified are noted in the
comments.  This file can be renamed as long as the file extension remains .cfm
-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
  "http://www.w3.org/TR/html4/loose.dtd">
<HTML lang='en'>
<HEAD>
	<TITLE> Sample SIM Implementation </TITLE>
</HEAD>
<BODY>


<!-- This section generates the "Submit Payment" button using Coldfusion     -->
</cfoutput>
<!--- the parameters for the payment can be configured here --->
<!--- the API Login ID and Transaction Key must be replaced with valid values --->
<cfset loginID="xxxxxx">
<cfset transactionKey="yyyyyy">
<cfset amount="19.99">
<cfset description="Sample Transaction">
<cfset label="Submit Payment"> <!--- This is the label on the 'submit' button --->
<cfset testMode="false">


<cfset posturl="https://secure.authorize.net/gateway/transact.dll">

<!--- If an amount or description were posted to this page, the defaults are overidden --->
<cfif IsDefined("FORM.amount")>
  <cfset amount=FORM.amount>
</cfif>
<cfif IsDefined("FORM.description")>
  <cfset description=FORM.description>
</cfif>
<!--- also check to see if the amount or description were sent using the GET method --->
<cfif IsDefined("URL.amount")>
  <cfset amount=URL.amount>
</cfif>
<cfif IsDefined("URL.description")>
  <cfset description=URL.description>
</cfif>

<!--- an invoice is generated using the date and time --->
<cfset invoice=DateFormat(Now(),"yyyymmdd") & TimeFormat(Now(),"HHmmss")>

<!--- a sequence number is randomly generated --->
<cfset sequence=RandRange(1, 1000)>

<!--- a timestamp is generated --->

<!--- old cfset timestamp --->
<!---<cfset timestamp=DateDiff("s", "January 1 1970 07:00", DateConvert('local2UTC', Now())) >--->

<!--- new cfset timestamp, per _agx_ --->
<cfset timestamp = dateConvert("local2Utc", now() )>

<!--- The following lines generate the SIM fingerprint --->

<cf_hmac data="#loginID#^#sequence#^#timestamp#^#amount#^" key="#transactionKey#">

<cfset fingerprint=#digest#>

<cfoutput>

<!--- Print the Amount and Description to the screen.--->
Amount: #amount# <br />
Description: #description# <br />

<!--- Create the HTML form containing necessary SIM post values --->
<FORM method='post' action='#posturl#' >
<!--- Additional fields can be added here as outlined in the SIM integration
guide at http://developer.authorize.net --->
<INPUT type='hidden' name='x_login' value='#loginID#' />
	<INPUT type='hidden' name='x_amount' value='#amount#' />
	<INPUT type='hidden' name='x_description' value='#description#' />
	<INPUT type='hidden' name='x_invoice_num' value='#invoice#' />
	<INPUT type='hidden' name='x_fp_sequence' value='#sequence#' />
	<INPUT type='hidden' name='x_fp_timestamp' value='#timeStamp#' />
	<INPUT type='hidden' name='x_fp_hash' value='#fingerprint#' />
	<INPUT type='hidden' name='x_test_request' value='#testMode#' />
	<INPUT type='hidden' name='x_show_form' value='PAYMENT_FORM' />
	<input type='submit' value='#label#' />
</FORM>
<!-- This is the end of the code generating the "submit payment" button.    -->

</BODY>
</HTML>
<!-- The last line is a necessary part of the coldfusion script -->
</cfoutput>

Open in new window

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Eric Bourland

ASKER
p.s. your notes about editing the JVM file make sense.
_agx_

>> 2) Web server (Windows 2008 R2) is set to UTC ....

Yes, I don't *think* it should matter since the time value is coming from CF, which seems correct at this point.


>> 3) JVM is apparently set to EST -- correct?

Correct


>> 4) the (97) error persists and authorize.net chortles at my failure ;-)

Maybe the URL is left over April fool's joke, that's not supposed to work ;-)



>> Could that be the problem?

I'm not sure. It depends on their API? Do you have link to the API field definitions (ie what each field should contain)? I did a cursory search but did not find anything.
_agx_

>> <INPUT type='hidden' name='x_fp_timestamp' value='{ts '2014-08-14 18:11:47'}' />

Hm... that's CF's special format for date objects.  I'm wondering if that's what's causing the current problem. Usually API's are expecting something like YYYY-MM-DD HH:MM:SS" - without the "{ts.." and "}".  So you'll probably need to use Date/TimeFormat on the #timestamp# value first.

What does the API say?
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

Found the docs. It says this about the x_fp_timestamp:

       Format : UTC time in seconds since January 1, 1970

I think that's the problem. (I also understand why you were using DateDiff in the commented line of code now).  Hate to say it, but what you had originally should work. Just get rid of the 7+ hour offset, ie

<cfset timestamp=DateDiff("s", "January 1 1970", DateConvert('local2UTC', Now())) >
Eric Bourland

ASKER
I just got back; sorry; been doing six things at once today.

I have been perusing the descriptions of the API fields:

http://developer.authorize.net/guides/SIM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=SIM_Submitting_transactions.06.3.html

"x_fp_timestamp
Value: The timestamp at the time of fingerprint generation.

Format: UTC time in seconds since January 1, 1970

Notes: Coordinated Universal Time (UTC) is an international atomic standard of time (sometimes referred to as GMT). Using a local time zone timestamp will cause fingerprint authentication to fail. If the fingerprint is more than one hour old or more than 15 minutes into the future, it is rejected. "

I think we found the same thing.

<cfset timestamp=DateDiff("s", "January 1 1970", DateConvert('local2UTC', Now())) > 


Hmmm.

OK. I'll go back to this and see what happens. I'll try this now. More soon. E
_agx_

Yes, the earlier version used 7AM

             "January 1 1970 07:00"

instead of midnight

              "January 1 1970"

That combined with DateConvert('local2UTC', Now()) - which you already added - should make things work properly.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Eric Bourland

ASKER
So, I should use this:
<!--- a timestamp is generated --->

<!--- old cfset timestamp --->
<cfset timestamp=DateDiff("s", "January 1 1970 07:00", DateConvert('local2UTC', Now())) >

<!--- new cfset timestamp, per _agx_ --->
<!---<cfset timestamp = dateConvert("local2Utc", now() )>--->

I tried an offset of 7 hours (07:00) and 4 hours (04:00). Both are still giving me the (97) error.

I'll play with this some more.
_agx_

No, remove the "07:00" entirely.  You want to calculate the dateDiff from January 1, 1970 at midnight, not some other time of day.  Do something like this:


<cfset timestamp=DateDiff("s", "January 1 1970", DateConvert('local2UTC', Now())) > 


EDIT: By omitting the time portion ie HH:MM, CF implicitly uses midnight. That's the start of the UNIX epoch, ie what the API specifies you should use.
Eric Bourland

ASKER
Got it.

I miss UNIX. Those were the days. Maybe I should go back. =)

Hmm. Darn. I tried this:

<!--- a timestamp is generated --->

<!--- set cfset timestamp --->
<cfset timestamp=DateDiff("s", "January 1 1970", dateConvert("local2Utc", now()))>

<!--- new cfset timestamp, per _agx_ --->
<!---<cfset timestamp = dateConvert("local2Utc", now() )>--->

<!--- The following lines generate the SIM fingerprint --->

<cf_hmac data="#loginID#^#sequence#^#timestamp#^#amount#^" key="#transactionKey#">

<cfset fingerprint=#digest#>

I am still getting the (97) error.

Think I should try to edit the JVM file?
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Eric Bourland

ASKER
What do you think "s" means in the DateDiff function?

<cfset timestamp=DateDiff("s", "January 1 1970", dateConvert("local2Utc", now()))>
_agx_

"s"  is the date part: ie seconds.

So like the API mentions, you are calculating the "UTC time (elapsed) in seconds since January 1, 1970 (at midnight)".
_agx_

I get the feeling I'm missing something obvious, but my brain is too fried to see it.  

Did they give you an example you can match? Like "If it's 08/14/2014 04:52 PM in Eastern daylight time, the current GMT would be  MM/DD/YYYY HH:MM". So the expected timestamp value is xxxxxxx"
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Eric Bourland

ASKER
Dear _agx_,

They did not give me an example like that, though it would have been helpful.

I am going to do some more research on this. I am also going to call authorize.net again tomorrow and ask about it.

My brain is pretty fried too. =) Long day.

I hope this finds you well and that a restful evening, free of coding and problems and such, awaits you.

I will work on this a little more this evening, and check in here tomorrow. Take care.

Eric
Eric Bourland

ASKER
Good morning, _agx_,

I submitted this question to the developer's forum at authorize.net.

In the meantime I think I am going to get Viviotech to do a backup of my server and ColdFusion settings, and then I am going to change the JVM datetime in ColdFusion admin.

Just to see what happens. =)

I will let you know. Thank you again for your help. Have a great Friday.

Eric
Eric Bourland

ASKER
I've been reading up on your notes, and the documentation, about changing the time zone in JVM.

In the meantime I've found this tool:

http://developer.authorize.net/tools/responsecode97/

Though I am not sure about some things:
1) how to derive a value in seconds from the timestamp from my web server
2) if this is even useful to use, since we know there is a difference of four hours, since the JVM is set to EST; thus, we can predict the output of the tool
3) Would this tool answer your question:

Did they give you an example you can match? Like "If it's 08/14/2014 04:52 PM in Eastern daylight time, the current GMT would be  MM/DD/YYYY HH:MM". So the expected timestamp value is xxxxxxx"

4) If so, can we set a value for variable #timestamp# that is +14400 seconds (four hours)?

<cfset timestamp= .... add 14400s ....>

I'm wandering here, and might be on the wrong track.

E
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Eric Bourland

ASKER
I've made these results appear:

Your timestamp = 1408119798 seconds.
The Authorize.Net system timestamp is 1408123416 seconds.
The difference is -3618 seconds.

So, my server is offset by -3618 s.

Is there some way I can use DateConvert or DateDiff to make up this difference?

I am researching this. I feel like I am making progress.

E
_agx_

Sorry. On a deadline today.  

Good find with the response code tool.  I can't test it right now, but it sounds like your server time is off by 1hr +/- a partial minute.  Possibly the whole DST thing.  Which is curious because I would have thought local2utc would account for DST.

Let me try a real quick test.. then I've got to get back to work.
Eric Bourland

ASKER
I tried replacing

<cfset timestamp=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now())) >

with a value, in seconds, for four hours (14400 seconds):

<!--- set cfset timestamp --->
<cfset timestamp=DateDiff("s", "January 1 1970 00:00", 14400) >

That did not work. I feel like I am missing a core concept here. =)

At this point I wonder if it is easier to edit the timezone in the JVM.config?

# Arguments to VM
java.args=-server -Xmx512m -Duser.timezone=America/Los_Angeles -Dsun.io.useCanonCaches=false
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Eric Bourland

ASKER
_agx_ if you have a lot to do, please don't spend time on this. You've been a hero already. =) It can wait till later.
_agx_

Thanks, it's been one of those weeks ;-) For you too I'm sure.

If you're going to try changing the jvm.config file (or the Java and JVM settings in the CF Admin), you might just go with GMT all around. Like I mentioned, changing it is easy.  Just keep in mind that will affect anything using the time ie now(). I don't know what (if any) impact that will have on your app. Of course you can always change it back. Just make the modification and restart CF.
Eric Bourland

ASKER
So I just add this at the end of JVM.config:
# Arguments to VM
java.args=-server -Xmx512m -Duser.timezone=America/New_York -Dsun.io.useCanonCaches=false

Open in new window


.... does that look right?

I've been reviewing post and the adobe forum page you referred me to.
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

I just tried adding the "-Duser.timezone..." part to my CF10 install and it didn't crash it :)  So it should be ok.  

Just be sure you have your backup file and all's good with the world.
Eric Bourland

ASKER
Here is the original, current JVM.config:
# Arguments to VM
java.args=-server -Xmx512m -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/../ -Djava.security.policy={application.home}/../lib/coldfusion.policy -Djava.security.auth.policy={application.home}/../lib/neo_jaas.policy -Dcoldfusion.classPath={application.home}/../lib/updates,{application.home}/../lib,{application.home}/../gateway/lib/,{application.home}/../wwwroot/WEB-INF/cfform/jars,{application.home}/../wwwroot/WEB-INF/flex/jars -Dcoldfusion.libPath={application.home}/../lib

Open in new window


I think that is all one line!

So, the new JVM.config will be:

# Arguments to VM
java.args=-server -Xmx512m -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/../ -Djava.security.policy={application.home}/../lib/coldfusion.policy -Djava.security.auth.policy={application.home}/../lib/neo_jaas.policy -Dcoldfusion.classPath={application.home}/../lib/updates,{application.home}/../lib,{application.home}/../gateway/lib/,{application.home}/../wwwroot/WEB-INF/cfform/jars,{application.home}/../wwwroot/WEB-INF/flex/jars -Dcoldfusion.libPath={application.home}/../lib 
-Duser.timezone=America/New_York -Dsun.io.useCanonCaches=false

Open in new window


Think that will work?

I'm so sorry to interrupt you when you are under deadline.
# Arguments to VM
java.args=-server -Xmx512m -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/../ -Djava.security.policy={application.home}/../lib/coldfusion.policy -Djava.security.auth.policy={application.home}/../lib/neo_jaas.policy -Dcoldfusion.classPath={application.home}/../lib/updates,{application.home}/../lib,{application.home}/../gateway/lib/,{application.home}/../wwwroot/WEB-INF/cfform/jars,{application.home}/../wwwroot/WEB-INF/flex/jars -Dcoldfusion.libPath={application.home}/../lib

Open in new window

Eric Bourland

ASKER
rather:

# Arguments to VM
java.args=-server -Xmx512m -Duser.timezone=America/New_York -Dsun.io.useCanonCaches=false -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/../ -Djava.security.policy={application.home}/../lib/coldfusion.policy -Djava.security.auth.policy={application.home}/../lib/neo_jaas.policy -Dcoldfusion.classPath={application.home}/../lib/updates,{application.home}/../lib,{application.home}/../gateway/lib/,{application.home}/../wwwroot/WEB-INF/cfform/jars,{application.home}/../wwwroot/WEB-INF/flex/jars -Dcoldfusion.libPath={application.home}/../lib
# Arguments to VM
java.args=-server -Xmx512m -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/../ -Djava.security.policy={application.home}/../lib/coldfusion.policy -Djava.security.auth.policy={application.home}/../lib/neo_jaas.policy -Dcoldfusion.classPath={application.home}/../lib/updates,{application.home}/../lib,{application.home}/../gateway/lib/,{application.home}/../wwwroot/WEB-INF/cfform/jars,{application.home}/../wwwroot/WEB-INF/flex/jars -Dcoldfusion.libPath={application.home}/../lib

Open in new window

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
_agx_

EDIT:

It's important to keep it all on one line. Also, I think the -XX arguments should come 1st.

The trick I use when adding an argument that starts with "-D..." is to look for the 1st one that starts with that prefix, then put my new argument in front of it.  So if my old CF10 config line started like this:

# Arguments to VM
java.args=-server -Xms256m -Xmx512m -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.home={application.home} .... etctera ....

Open in new window


The 1st "-D" arg is "-Dcoldfusion.home={application.home}". So I just paste in the new arg before " it like so:

# Arguments to VM
java.args=-server -Xms256m -Xmx512m -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch  -Duser.timezone=GMT  -Dcoldfusion.home={application.home} .... etctera ....

Open in new window

Eric Bourland

ASKER
Got it. I will try this late tonight so if anything goes ka-boom, I can fix it back.

Wishing you a lot of luck with your current project. May all go smoothly.

I'll work on this over the weekend and get back to you.

Thanks very much, as always. Take care,

Eric
Eric Bourland

ASKER
Update: I edited jvm.config very carefully, using your notes above. I restarted CF. Web sites are all OK.

But .... I have a silly question ... what is the correct syntax to use for UTC / GMT time? The below argument works for EST.

Some places I have found indicate -Duser.timezone=UTC is the correct syntax. What do you think?

Hope you are enjoying the weekend.

Eric

# Arguments to VM
java.args=-server -Xmx512m -XX:MaxPermSize=192m -XX:+UseParallelGC -Duser.timezone=America/New_York -Dsun.io.useCanonCaches=false -Xbatch -Dcoldfusion.rootDir={application.home}/../ -Djava.security.policy={application.home}/../lib/coldfusion.policy -Djava.security.auth.policy={application.home}/../lib/neo_jaas.policy -Dcoldfusion.classPath={application.home}/../lib/updates,{application.home}/../lib,{application.home}/../gateway/lib/,{application.home}/../wwwroot/WEB-INF/cfform/jars,{application.home}/../wwwroot/WEB-INF/flex/jars -Dcoldfusion.libPath={application.home}/../lib

Open in new window

âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Eric Bourland

ASKER
It's -Duser.timezone=GMT.

I edited jvm.config and restarted CF and web sites are working. Testing the authorize.net application....

Holy moly, it works.

I'll follow up tomorrow, but it looks like that was it.

=)

Just did a little cheer and fist pump, like a college student.
_agx_

Yep. that's what I used here. :) Not sure if UTC works too.

> Holy moly, it works.

Awesome. Finally!

Though I'm still curious why DateConvert didn't work. I must be missing something... Otherwise, what's the point of having a "local2UTC" option if you still end up having to change the jvm time zone. If this week ever ends ... I'll have to try and figure it out ;-)
ASKER CERTIFIED SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Eric Bourland

ASKER
Elegant, simple solution. Working perfectly.

I have learned a tremendous amount about JVM, authorize.net, and new ColdFusion functions.

Many thanks, as always, to _agx_, for patience and investigation and guidance. This question required a lot of research and perseverance. I'm deeply grateful.

_agx_, hope your weekend is going very well. Take care. =)

Eric
Your help has saved me hundreds of hours of internet surfing.
fblack61
_agx_

Hope you enjoy the remainder of the weekend Eric :) Try not to work too much!