View Full Version : A weekly variable counter.
07-16-2003, 04:37 AM
I am have been trouble trying to create a counter that will every week add a set amount to a variable using Java. I have been trying a number of different things, but unfortunately, nothing has worked the way I have wanted it to. I simply want that at every Thursday, it will add 1 to a variable. Does anyone have any ideas?
07-16-2003, 07:59 AM
today = new Date();
day = today.getDay();
Or do you mean that you want the variable to be incremented
each Thursday and that value retained? If so you will need
either a server side language or perhaps a cookie.
You could also calculate the date using the date.getTime() function which returns the number of milliseconds since midnight on 1st January 1970. There are 604800000 milliseconds in a week.
07-16-2003, 04:58 PM
I was actually looki9ng to have the variable retained and each week, it would become larger and larger. I do appreciate it and I'll fiddle with your code a little to see if it is what I need. If anyone has something else, that would be great too.
07-16-2003, 07:15 PM
You need a server side language such as Perl, but then of course
what you want is very easy to achieve.
07-17-2003, 03:47 AM
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.