Hi, John...
Looks like you're progressing nicely with the CF!
I was tinkering with the days involved and trying to figure out
a way to make sure that the days were always calculated properly
considering the time difference.
The only way I could make them come out correctly was to do this:
<cfset serverDay = #createODBCdatetime(now())#>
<cfset tipDay = #day(dateadd('h',-6,serverDay))#>
<cfoutput>serverDay = #day(serverDay)#</cfoutput>
<cfoutput>tipDay = #tipDay#</cfoutput>
Since you're calculation of the day involves hours, I had to create
a datetime object and then subtract 6 hours from that to make the
"tipDay" show the proper day since it is 6 hours behind the
"serverDay" in NJ.
If I just created a date object using createODBCdate instead of
createODBCdatetime, the day calculation was always wrong because
the time value of "createODBCdate" is calculated from 00:00:00 or midnight.
So even if it was 3pm on day 9 of the month in NJ, if you create a day object
with "createODBCdate"
the time will show as 00:00:00. Subtract 6 hours from that and your time
is not 3pm - 6 hours, or 9am on day 9, but 00:00:00 - 6 hours, or 6pm on day 8.
I may be making this a lot harder than it really is, but this is the only
way I could make the calculation work. Others may have a better approach.
Try those cfset calculations above and see if the days work out right for you.
It's almost 1am here on the East Coast in Georgia (also NJ time) and I'm
sleepy, so I may not be thinking clearly or making much sense.
It's only 6:51pm in Hawaii, I think!
Rick
> -----Original Message-----
> From: John Barrett [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 08, 2008 10:12 PM
> To: CF-Newbie
> Subject: server time
>
> Hi,
> First I would like to thank everybody for all there help on my project:)
>
> I am trying to figure out how I can be sure that the daily tip is the current
> date here in Hawaii.
The
> server is located in New Jersey, which is 6 hours ahead of Hawaii. Eventhough
> it is a daily tip,
> everyday at 6:00pm in Hawaii the day changes on the server, but not here in
> Hawaii.
>
> What I have is below, and I am wondering if this will work, or if I should
> change the "time"
setting, as
> I think I have create it, but am not calling it in the cfquery? Am I wrong
> about this, or does
this just
> get included in the cfquery? In the first <cfset, I tried to add the dataadd,
> but got an error.
>
> thanks so much,
> John
> <!--- Code--->
> <cfset tipdate = #CreateODBCDate(now())#>
> <cfset time = Now()>
> <cfset time = dateadd("h",-6,time) />
>
>
> <cfquery name="rs_dailytip" datasource="#REQUEST.dataSource#">
> SELECT record_id, tipdate, dailytip, consumer_link, research_link
> FROM daily_tip_new
> WHERE tipdate = #tipdate#
> </cfquery>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-
> transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
> <title>Untitled Document</title>
> </head>
>
> <body>
> <cfif rs_dailytip.recordcount>
> <cfoutput>#DateFormat(tipdate, "mmmm d, yyyy")#</cfoutput><br />
> <cfoutput>#rs_dailytip.dailytip#</cfoutput>
> <cfelse>No Daily tip today!
> </cfif>
> <br />
> Consumer Related Article:<br />
> <cfoutput>#rs_dailytip.consumer_link#</cfoutput>
> <br />
> Research Related Article:<br />
> <cfoutput>#rs_dailytip.research_link#</cfoutput>
> <p>
> <cfoutput>The time= #TimeFormat(time,'h:mm tt')#</cfoutput>
>
> </body>
> </html>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3908
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15