If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Useful time-based content code snippets

Hi,

I've been using some php code to display time-based, promotional content on my website, which is set to expire on a certain date. Its really useful in the sense that you dont have to sit by your computer to make website updates on the dates specified - you can code your pages well in advance and the scripts automatically switches content over on the defined days.

Anyway, I thought the code might be useful to others so here it is.

Please note, I found parts of the code snippets on other forums/the web and have slightly modified them and mashed them together for my own needs. They're not rocket science but I don't want to claim to have written them myself.

HTML doesn't allow anything like this-- you can't check the time, and you can't use "if" to sometimes show one thing and other times show something else. You need a serverside language like PHP (or ASP.net, CGI, SSI, etc.), or a clientside language (probably Javascript), not just HTML.

You can use GMT because you just need to base your times on that. Your server will be configured for a certain timezone, so you can either change the timezone setting, or you can simply set this for another time (for example, add "+6" to all of your hours, or whatever is required.)