View Full Version : Changing the date
flash
01-03-2003, 11:57 AM
Hello everyone.
I have a problem:
I have a page that takes a date from a Database, in the form of 12/1/2003
Once this is taken from the database, I need it to be shown increased a year. For example, it will now be 12/1/2004.
VBScript is out of the question. I only EVER use Javascript. If anyone could help then that would be great! :thumbsup:
Thanks.
Flash
miranda
01-04-2003, 12:15 AM
var todaysdate = new Date();
var thisyear = (todaysdate.getYear());
var nextyear = (thisyear + 1);
whammy
01-04-2003, 01:10 AM
Here's an excellent javascript reference regarding Date functions... although it's client-side, the date handling is also applicable to server-side javascript...
http://www.w3schools.com/js/js_datetime.asp
Don't forget to check the http://www.javascriptkit.com tutorials, either!
P.S. there's no reason VBScript should ever be "out of the question" regarding server-side ASP, since you can use JavaScript and VBScript interchangeably (and in "classic" ASP (as opposed to .NET), you can even use both types of server-side scripting on the same page) - not to mention VBScript has some really good Date/Time functions already built in that JScript (JavaScript) does not have!
Mhtml
01-04-2003, 05:30 AM
Originally posted by whammy
P.S. there's no reason VBScript should ever be "out of the question" regarding server-side ASP, since you can use JavaScript and VBScript interchangeably (and in "classic" ASP (as opposed to .NET), you can even use both types of server-side scripting on the same page) - not to mention VBScript has some really good Date/Time functions already built in that JScript (JavaScript) does not have! [/B]
I agree completely.
Vbscript has the best date handling features classic asp. In my opinion if you are going to use classic asp than you are best to use VBscript because Javascript is just ridiculous.
flash
01-06-2003, 08:50 AM
Thanks everyone :thumbsup:
Its all done and sorted now!
The reason I cannot use VBScript is because I work for a Web Design company and we tend to always use Javascript because not all browsers will support VBScript.
Thanks again.
Flash
glenngv
01-06-2003, 09:17 AM
So what you were really asking for is client-side javascript solution. You posted on the wrong forum. This is the ASP Forum, thus their reaction. You said the date is retrieved from a database, so you must be using a server-side language. I think it's better to let the server-side language manipulate the date rather than let client-side javascript do it. As you all know, javascript can be turned off in the client.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.