View Full Version : Anyone auto date change code?

03-01-2004, 03:02 PM
I have a date that needs to stay static for one week at a time. Like: "offer ends 5/19/04". Anyone know code that will make that auto change every week to the following week. 5/26/04, 6/2/04 etc.

Thanks in advance.

03-08-2004, 01:06 AM
Maybe this?

<script language="JavaScript">
function addDays(myDate,days) {
return new Date(myDate.getTime() + days*24*60*60*1000);

document.write(addDays(new Date(),7));

This adds 7 days onto today's date. Or should do :o

03-08-2004, 03:05 PM
Works great! Thanks for your help.

Len Whistler
03-09-2004, 04:35 AM
With javascript if the users computers time is off then so will the time on your site. How about php instead? The server time is probally more reliable.

Below is my php footer on my site. The 2001 always stays the same but the echo date line changes with the year.

echo ' 2001-';
echo date('Y');
echo ' Leonard Whistler';
echo '<br>email: len_whistler@yahoo.com';

Leonard Whistler

09-23-2009, 05:30 PM
does anyone know how to make this work on a daily basis auto changing at 3pm and skipping sunday?

Bit of a challenge.. In case I havnt explained it properly we run a site that shows the next day delivery date. if an order is placed after 3 it wont get there next day..