Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using date in a combo box + JSP & HTML

Status
Not open for further replies.

KenWan

Programmer
Feb 27, 2004
14
GB
Im having trouble formatting the current date into yyyy, to be passed into a combo box with the years going back 50 and forward 50. Im new to jsp + html and java script <yes another newbie> Can you also provide a short example if not just direct me to other useful source of info on my current annoyance.
 
Woo Hoo I got the current year out with
Code:
<script type="text/javascript">
		<!--
		var now = new Date();
		var yr  = now.getYear();	
		var fyr	= (yr < 1900) ? 1900 + yr : yr;
		document.write(fyr);
		//-->
		</script>
Now all I have to do is figure out how to get it to go 50 years back, pop it into and array pass that it into a drop list or combo box then just pass a year out to be saved in a txt box :) That should keep me busy for the next few years.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top