View Full Version : Dreamweaver or script help??

09-24-2007, 04:11 AM
I am doing a site for a freind, in Dreamweaver.

What I am trying to achieve is the site is a sales letter, thats says order by XX date, and you will recieve a bonus...You get the idea...

What we are trying to achieve is that whatever day a customer looks at the site that the order by date will automatically change to a defined period ahead. So if i look today, the order by date is say 3 days ahead. And it to be say always 3 days ahead.

Any help from anyone on this would be great.


09-24-2007, 04:29 AM
Where the text needs to appear put this code

<?=date('F d Y', time()+259200)?>

259200 is the number of seconds in 3 day, so thats what has to be changed if needed

Also make sure that the webpage you use that on is a .php page

EDIT: Also if you want to change how the date is displayed, heres the documentation for the date function


09-24-2007, 05:58 AM
Thanks Watdaflip,

Worked a treat, after a bit of fiddling around. One question is, what clock does it go from? I change the date on my computer to see if it would change, but didnt. I have changed it to four days, but as per time here in Tassie ( Australia) it doesnt really match 4 days????

The site for interest is www.justhairdressing.com (http://www.justhairdressing.com) if you scroll down most of the page you will see the dates I am talking about.

Thank you very much.

09-24-2007, 10:55 AM
The above code is based on server time and can be fixed to your own timezone. However, the displayed offer expiry will always be the same: i mean, if the user visits today and sees that the offer expires on Friday, if he then visits again tomorrow, he will see that the offer expires on Saturday. It can not trace the user and give him always a 4 day expiry from the first time he ever visited. To achieve this, you would need to cookie his computer with the first ever visited date + 4.
The script would need to follow these steps:

1. When a user visits the site for the first time, the script will cookie the users computer with the expiry date, set to be 4 or whatever number of days you set it to be, after the actual date.

2. When the user visits again, the script will "see" the cookie, and display the cookie value as expiry date, so it will display this date as expiry date. If there is no cookie, you are again in the conditions described in point 1.

3. The script should also verify that the offer is not expired, in which case it should display no message at all.

The logic is the same as for cookies used for the "Remember me" feature of login scripts.

09-24-2007, 11:30 AM
Tank you naval, for your response, is there any category you do not read...ha ha ha ha. As the code is now, my mate is quite happy with. He has his response ready if customers call. The time frame as it is set now my freind is quite happy with.

Thank you for your time and response and all others who respond.


09-25-2007, 02:15 AM
Hi Naval,

If you read this or anyone else, how would i adjust the line of code to show our time zone here in Tasmania. My timezone here is +10 hours????

I dont think we need to worry about cookie ing someones computer, how ever if it is non invasive and easy enough code, my mate may consider it.

Your thoughts and advice are much appreciated.

09-25-2007, 02:58 AM
This post should help you


09-25-2007, 03:32 AM
Hi Watdaflip,

Unless I am reading it wrong, I dont know whether or how to change the code as in that post you show?? I must be having a brain freeze.

This is the code I have in the site at the moment.
<?=date('F d Y', time()+345600)?>

As I mentioned the only thing is it is going on server time, not local time here. I presume it will change date later tonight here in OZ.


09-25-2007, 06:31 AM
Well, it is really easy. Since Tasmania is Australia/Hobart timezone, transform the script as followes:

echo date('F d Y', time()+345600)

09-25-2007, 06:55 AM
Thank you Naval, I just checked the date from what it was this morning, and it changed, so server time must of also changed days? I pasted the appropriate code and will now stay up till midnight and see if it changes...lol.

Thank you very much for your time.

09-25-2007, 08:07 AM
Server date changes at midnight server time. When you put the time zone in your script, as suggested, the displayed date will change at midnight Tasmanian time.