Home Answers Viewqa Date-Calendar Addintion in year fields of sql date in a java page

 
 


Pramit Bhaumik
Addintion in year fields of sql date in a java page
1 Answer(s)      a year and a month ago
Posted in : Date-Calendar

In my database i have a field StartDate and EndDate Now entering date from my jsp and fetching it in the servlet

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


              Date date = new Date(request.getParameter("date"));
              SimpleDateFormat simpleDateformat=new SimpleDateFormat("yyyy");
              System.out.println("Year: " + simpleDateformat.format(date));
             String k= simpleDateformat.format(date);
            }

But I have to add 4 with the year value and generate the date after 4 years of Starting Date and store it into the database

View Answers

March 31, 2012 at 1:12 PM


The given code is useful.

try{
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
 Date d=(Date)formatter.parse("30-03-2012");
 Calendar cal=Calendar.getInstance();
 cal.setTime(d);
cal.add(Calendar.YEAR, 4);  
String newdate = formatter.format(cal.getTime());
System.out.println(newdate);
     }
     catch(Exception e){}









Related Pages:
Addintion in year fields of sql date in a java page
Addintion in year fields of sql date in a java page  In my database...("Year: " + simpleDateformat.format(date)); String k= simpleDateformat.format(date); } But I have to add 4 with the year value
SQl Date
SQL Date       The SQL Date is used when you are working with dates. This include... The Tutorial illustrate a Example from SQL Date. In this Tutorial, we
SQL Date, SQL Date Examples
SQL Date      ... Date Today in My sql. The Query used in the below example the now... to write the Date Format in SQL Query.    Mysql Date
fields
fields  hi.create a class named librarybook that contains fields to hold methods for setting and getting a librarybooks title,author, and page count
Add year to Date without using Calendar in java
Add year to Date without using Calendar in java  how could i add a year to a date function without using calendar functions
convert date month and year into word using java
convert date month and year Java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
JDBC : Get year from Date
')"; rs = statement.executeQuery(sql); System.out.print("Year of given date...JDBC : Get year from Date In this section, you will learn how to get year from date. Get year from Date : In MySql you can get year from the given Date
convert date month and year into word using java
Java Date Month Format  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
convert date month and year  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Match Date format  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Basic format for Date and Month  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Convert Date Month format  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Date Format in Jave  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
Convert Date Format  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   Visit Here
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   import java.util.*; import java.text.
convert date month and year into word using java
convert date month and year into word using java  convert the date, month,year into word like 12-3-2012 into twelve march two thousands twelve pls send the code write in java.   import java.util.*; import java.text.
Java get year from date
Java get year from date     ... showing the format of year. The method simpleDateformat.format(date) formats a Date into a date/time string and returns the year.      
JSP:How to get year of system date - Date Calendar
Year: "+year ); } } For more Examples on Java visit to : http...JSP:How to get year of system date  Please tell me how to get year of system date; I am doing import java.util.*; Date d = new Date(); d.getYear
Fields in java class
Fields in java class       In this section, we will explore the concept of the fields in the reference of object oriented programming techniques. There are two part of the field
SQL
SQL       SQL SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database. SQL*Plus SQL*Plus
Java date add year
Java date add year In this tutorial, you will learn how to add years to date. Here, we are going to add few years to current date and return the date of that day. For this, we have created a calendar instance and get a date
name of year in chinese
Cambodia, i would to write java programming to calculate a name of year for each...: 2011 Your Birth Date is 2/10/2011 = Sunday - OCTOBER - Rabbit Year.  ... of birth: 02 Enter month of birth: 10 Enter year of birth: 2011 Your Birth Date
name of year in chinese
name of year in chinese   hello my name kiemtheng i'm come from Cambodia, i would to write java programming to calculate a name of year for each...[] args) { Locale locale=Locale.FRANCE; Date today = new Date
date problem in sql server - SQL
date problem in sql server  select count(*) from xxxx_tbl where emplid="+emplid+" and work_dt=#"+work_date+"#"; work_date is in string ,Backend is sql server 2000.i am getting the date problem when using in jsp page.  
JSP Financial Year Table
JSP Financial Year Table  Im trying to design a financial year table... in backend.i have successfully desinged the page but i have certain doubts in jsp......or else kindly suggest me to some alternative.I have given names for all fields
Mysql Date Add Year
Mysql Date Add Year       Mysql Date Add Year explains to add the year to the particular date... that add a 1 Year to the particular date.  SYNTAX:-ADDDATE(date,INTERVAL
End of Year Puzzle
Puzzle in Java Here am going to write a question as a puzzle, it is also very similar to the those questions you find in the SCJP (Sun Certified Java Programmer)  examination public class LittleFuzzy { public int method(int
Mysql Year of Date
Mysql Year of Date       Mysql Year of Date is used to return the current year of the table... (current_date) that return the current year of  the table. Current_Date
Mysql Date Get Year
Mysql Date Get Year       Mysql Date Get Year is the way of retrieving the current year. Understand with Example The Tutorial illustrate an example from 'Mysql Date Get Year
Mandatory Fields Validation - Java Beginners
Mandatory Fields Validation  In my login servlet, i have fields... javascript. Call a javascript function before submit the page. Example... this through javascript. Call a javascript function before submit the page. Example
date in textbox on page load
date in textbox on page load   i want to insret the current date...() { var mydate = new Date(); var year = mydate.getFullYear... into textbox on page load. <html> <script> function addDate(){ date = new
Java util date
Java util date      ... date and time. It can be created specifying year, month, date. Years..., and second along with year, month and date. It can also be created specifying
Java Increment Date. - Java Beginners
Java Increment Date.  Create a program called Date.java to perform error-checking on the initial values for instance: fields month, day and year... ); } // Time3 constructor: day, month and year supplied. public Date( int d, int m
wrong year
*df = [[NSDateFormatter alloc] init]; [df setDateFormat:@"yyyy"]; NSDate *date = [NSDate date]; NSLog(@"%@", [df stringFromDate:date]); return; Its giving me wrong year..   I think u are using other calendar Check Settings
Initialising Fields before Superconstructor call - Java Tutorials
Initialising Fields before Superconstructor call 2004-03-20 The Java Specialists' Newsletter [Issue 086b] - Initialising Fields before Superconstructor... this, and have not subscribed, please consider doing it now by going to our subscribe page
Sql Date Conversion
Sql Date Conversion       The Tutorial illustrate an example from 'Sql Date Conversion'. To understand... the month name from the date you specified. %Y:-Returns the Year from the date
Initialising Fields before Superconstructor call - Java Tutorials
Initialising Fields before Superconstructor call 2004-03-19 The Java Specialists' Newsletter [Issue 086] - Initialising Fields before Superconstructor... not subscribed, please consider doing it now by going to our subscribe page. You can
SQL Date
SQL Date         The SQL Date is used when you are working with dates. This include... with Example The Tutorial illustrate a Example from SQL Date. In this Tutorial
Java Date Conversion
between a Date object and a set of integer fields such as YEAR, MONTH, DAY... Java Date Conversion In java date conversion, two packages are used... of date in year, month, day, hour, minute, and second values. It also allows
data fields
data fields  hi. write an application that instantiates five librarybooks objects and prompts the user for values for the data fields.then prompt the user to enter which foels the librarybooks should sort bt title,author or page
Sql Date and Time Format
Sql Date and Time Format       The Tutorial illustrate an example from the 'Sql Date and Time Format... in the order of Week,Day,Month,Year and time. SELECT DATE_FORMAT('2008-12-15
PHP Date add 1 year
Adding 1 year to a php date object is sometimes useful to solve some... program. <?php //Example to add 1 year to a date object... year to current date $dateOneYearAdded = strtotime(date("Y-m-d"
Subtraction of a date from Sql and other from java.
Subtraction of a date from Sql and other from java.  I want to subtract a date that i retrieve from mysql database with the system date that i retrieve from java. I want the difference between the two date in the integer form
Java to SQL Server Connectivity
Java to SQL Server Connectivity  Hi, heres my code private void..._name,cust_nic,cust_contact,cust_address,seat_no,departure_date,amount,total_amount,advance,remaining_amount,booking_date,checkin_date,current_status) VALUES
SQL - SQL
System Order Details Order No: Order Date: Name... please reply me ? Thank you sir. Database fields are:Table Name Regiter. Fields are:-- UserId Name Address Email PhoneNo
date print
date print  how can i print the date in jsp page in the following formate month-date-year. (example. march 8 2012
date print
date print  how can i print the date in jsp page in the following formate month-date-year. (example. march 8 2012

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.