I have created a website that has a "back" and "next" feature to take you
through an archive of images (daily cartoons). The code I wrote has worked
fine all throughout 2000, but for some reason 2001 is causing it problems.
Going "back" from any Jan. 2001 date keeps taking me to unusual dates. The
code is listed below. The site (and it's errors) can be found at:
http://www.inktank.com/
The functionality seems to work when the URL date is changed by hand. The
date format is in "yy-mm-dd" to facilitate the naming of the .GIF images.
The code below is located at the top of the page and the variables are
called from the body of the page.
----------------------------------------------------------------------
<!--- Get Today's Date --->
<CFSET TODAYSDATE = #NOW()#>
<!--- Set Up Today's Cartoon --->
<CFSET CURRENTTOON="#DateFormat(todaysDate, "YY-MM-DD")#">
<!--- Set up the name for today's toon for the daily "ATtoday" file --->
<CFSET DAILYTOON="#currentToon#">
<!--- If the URL.toon is not defined, default to today's cartoon --->
<CFIF NOT ISDEFINED("URL.toon")>
<CFSET URL.TOON="#currentToon#">
</CFIF>
<!--- If the archive toon is chosen, set the toon to the chosen archive
choice --->
<CFIF ISDEFINED("archive")>
<CFSET URL.TOON="#archive#">
</CFIF>
<!--- Convert the URL.toon to add and subtract dates --->
<!--- Sets Time Span For One Day --->
<CFSET YOURTIMESPAN = CREATETIMESPAN(1,0,0,0)>
<CFSET TOONFORMAT =#PARSEDATETIME(URL.TOON)#>
<CFSET NEXTTOON = #DATEFORMAT(TOONFORMAT + YOURTIMESPAN,
"yy-mm-dd")#>
<CFSET LASTTOON = #DATEFORMAT(TOONFORMAT - YOURTIMESPAN,
"yy-mm-dd")#>
--------------------------------------------------------------------------
Thank you in advance for your time and attention.
Barry T. Smith
GlobalSight Webmaster
http://www.globalsight.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