JavaScript Forum JS Made Easy: Free JavaScripts Tutorials Example Code
About This Product
FontsMadeEasy.com
 
The Business Internet
Find it on This page:
 
| Over 5000 Free Fonts | Tutorials | Javascript Forum | Other Javascript Resources | Cheat Sheet

     
Jsmadeeasy Forums Home   Search   Login   Register   Member List  
JS Made Easy  > JavaScript programming  > Re:  
 
Display using:  
Previous Thread :: Next Thread 
 Author Thread: Display year: In business for over "x" years...
dmr777 is not online. Last active: 7/28/2004 3:52:08 PM dmr777
Joined: 28 Jul 2004
Total Posts: 1
 
Display year: In business for over "x" years...
Posted: 20 Nov 2002 08:45 PM
I need to have the year automatically change annually so I can eliminate some page editing.

Could a kind soul please tell me how this can be done?

So after a particular date: Say July 1st of a year, the number would increment by one.


Always appreciate...

Darrell

qsaaiman is not online. Last active: 5/30/2006 4:23:08 AM qsaaiman
Top 25 Poster
Joined: 28 Jul 2004
Total Posts: 21
 
Re:
Posted: 22 Nov 2002 05:41 AM
Here is the code.
just put this at the bottom of the page & change the alert to write to the page.

<script language="JavaScript">
var curr_date = new Date()
var curr_year = curr_date.getYear()
var strt_year = "1996"

exist_years = curr_year - strt_year

alert(exist_years)
</script>

HTH

Quintin Saaiman

Quintin Saaiman
Previous Thread :: Next Thread 
Goto to page:  Prev Next
 
Jsmadeeasy.com  > JS Made Easy  > JavaScript programming  > Re: