Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2007, 07:31 AM
Authorized User
 
Join Date: Dec 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default adding years to date

Hi All

I have to add 12-year/12-month/30-day to input date entered by user how can i do this in javascript

with regards
Israr

 
Old March 23rd, 2007, 07:56 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

Please look at the following example

var exdate = new Date();
y1 += 12;
m1 += 12;
d1 += 30;
//where y1, m1 and d1 are year month and date entered by the user
exdate.setFullYear(y1,m1,d1);

now exdate will have the desired date.

Regards,
Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
date conversion in years, months and days naveed77 Beginning VB 6 0 January 2nd, 2008 01:18 AM
Adding Date parameter joeri BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 3 March 9th, 2007 03:50 PM
Pull years from date field kev_79 Access 2 August 2nd, 2004 01:49 PM
Adding a date to a memo field mikericc Access VBA 2 November 25th, 2003 10:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.