Automation of Image Update based on Date

Posted on 2009-12-22
Medium Priority
Last Modified: 2013-12-24
I am trying to basically have an image that's on a web page update based on the date.  So for example, when it hits the 1st of January it will change back to it's original image.  Right now it's set as a holiday image.  I was wondering if it was possible to do this with Coldfusion.  The server is running Coldfusion 8 if that helps any bit.  
Question by:Phylox
LVL 16

Expert Comment

by:Gurpreet Singh Randhawa
ID: 26109987
This quite easy:

use like this:

<cfif #DateFormat(now(),'mm/dd/yyyy') EQ '01/01/2010'>
     <img src="mainimage.jpg" border="0"/>
     <img src="holidayimages.jpg" border="0">

You also also setup the dates in the database and then make the comparision above with the dates you have in database. it will automatically be doing in the for the whole year for which you want to have holidays

LVL 27

Accepted Solution

azadisaryev earned 500 total points
ID: 26110885
>> <cfif #DateFormat(now(),'mm/dd/yyyy') EQ '01/01/2010'>

that will make the non-holiday image display ONLY on Jan 1, and not on any other day.

what you need is:

<cfif datecompare('01/01/2010', now()) LTE 0>

keep in mind, though, that this uses your server's time, not the time of your site's users. so a user coming from a timezone which is ahead of your server's timezone will still see a holiday image even though the user's time may already be past midnight of 1/1/2010


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question