Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


melheng
Calender code
1 Answer(s)      3 years and 9 months ago
Posted in : Java Beginners


how can i add 3 days to current date ?

i am using a script from jotform which has a calender field. the system shows the current date, but i want to add 3 days to the current date for the purpose that the client is only able to select dates 3 days after the current date. eg. if today is 1/1/2010, the only available dates he can select is 4/1/2010 on wards.

i am working on a school project & i really need help on this!!!

Please help me.


Advertisement
View Answers

December 11, 2010 at 11:54 AM


Hi Friend,

Try the following code:

import java.util.*;
class  Add3Days{
    public static void main(String[] args) {
    Calendar cal = Calendar.getInstance();
    System.out.println("Current date : " + ( cal.get(Calendar.DATE)) + "/" + (cal.get(Calendar.MONTH) + 1)+ "/"+cal.get(Calendar.YEAR));
    cal.add(Calendar.DATE, 3);
    System.out.println("Date after 3 days: " +  (cal.get(Calendar.DATE))+ "/"+ (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR));
}
}

Thanks



Related Tutorials/Questions & Answers:
Calender code
Calender code  how can i add 3 days to current date ? i am using a script from jotform which has a calender field. the system shows the current...; Hi Friend, Try the following code: import java.util.*; class Add3Days
Calender code
Calender code  hi, this is my script, where do i add your script below to? var Calendar = Class.create(); //------------------------------------------------------------------------------ // Constants
Advertisements
Calender code ! HELP!!!
Calender code ! HELP!!!  how can i add 3 days to current date ? i am using a script from jotform which has a calender field. the system shows... help me. This is my code: var Calendar = Class.create
want the code for calender in php+htmal page
want the code for calender in php+htmal page   i have to select a calendra for some textbox in an table
Calender in JSP
Calender in JSP  How can i use calender in my text box in JSP file
Calender in JSP
Calender in JSP  How can i use calender in my text box in JSP file
calender control
calender control  plz tell me about calender type control in java
calender event
calender event  hi, how we can set an alarm in calender through j2me and sending that reminder to another mobile? thanks in advance
calender applet
calender applet  here is my code im getting errors in 23,37,49lines like cant find symbols constructor,methods e.tc is it the code for calender beside textfield in a java awt.... import java.applet.*; import java.awt.*; import
java awt calender
java awt calender  java awt code for calender to include beside a textfield
calender devlopment - Java Beginners
calender devlopment  Sir i need help sir. Sir how to develop calender by using JAVA SWING. Here conditions are one textbox and one small button are needed for this application.whenever i click on small button small calender
how to use calender in php
how to use calender in php  how to put calender in php
calender in struts - Struts
calender in struts  when i execute the following code ,that is working properly if i convert to struts html tags that code is not working please help me to rectify the problem
calender working in struts - Struts
calender working in struts  when i execute the following code ,that is working properly if i convert to struts html tags that code is not working please help me to rectify the problem
dynamic calender
dynamic calender  hi i need the code to "insert date using GUI"   Hi Friend, Try the following code: import java.awt.*; import java.awt.event.*; import javax.swing.*; class DatePicker{ int month
Calender Reminders - JSP-Servlet
Calender Reminders  HI All, I need to create calender reminder.I need java coding for that.It must appear like microsoft outlook..Please help me regard this as this is some what urgent for me..Thank you in advance..Waiting
need popup calender - Date Calendar
need popup calender  Hi, I need a pop up calender code in html, but i guess javascript would be needed for event handling . I need a code which.... The background and foreground color of the pop-calender should be able tochange Thanks
Calender - JSP-Servlet
Calender  hi,i am designing a web portal in that my home page should display a calender. i want a calender to be displayed on my home page as jsp... i want is the calender with events showing the description on click Thanks
calender - JSP-Servlet
calender  i created a calender using java script but when i click the icon of the calendar it popups but when i again click the icon another popup opens without closing the previous one so i need the help to close it when i click
Calender - JSP-Servlet
Calender  My answer was not that u posted... A calender should be dispalyed with the current month and every date should be clickable on click at particular date any event in the data base should be checked and display
how to prevent user selecting past date from calender
how to prevent user selecting past date from calender  how to prevent user selecting past date from calender ex: today's date is 21st march user should not select 20th march or below
code
code  code for android sample program
code
code    how to write this in java
Code
Code  code for connecting c lang to database
code for this is
code for this is  a b c d c b a a b c c b a a b b a a a code
code
code  please provide code for custom tags.by using currdate tag we need to get current date?please give me code
code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
code
the correct code for a program.The output of the program is listed below...: {Block 5} ADDRESS-3: {San Juan} POST CODE:{6745} ENTER CODE (XX TO stop) CODE:{FF1} QUANTITY:{2} CODE:{TR4} QUANTITY:{1} CODE:XX INVOICE FOR YOUR ORDER Harry
code
code to create the RMI client on the local machine: import java.rmi.*; public... : "+e); } } } However, when the preceding code is executed it results... the correct code
code
code  i have four textboxes.whenever i click on up,down,left or down arrows then the cursor move to another textbox based on the key pressed.i want code for this in javascript
code
line of code to print the amount he should be paid as allowance
code
code  write a program to encrypt and decrypt the cipher text "adfgvx"   Hi Friend, Try the following code: import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import java.io.
calendra.css source code - Java Beginners
calendra.css source code  hello i need the source code... and year are getting displayed  Hi Friend, Try the following code: ***************calendar.css*************** #calender { width: 200px
Validation code - Java Interview Questions
not other). Thanx in advance  Hi friend, code to solve the problem... ************* Java Script Calender Date Picker function isNumberKey(value... **************** Java Script Calender Date Picker function isNumberKey
JAVA code For
JAVA code For   JAVA code For "Traffic signals Identification for vehicles
c code
c code  c code for this formula x=(y-0.22z-072)4; where y=7.32 x=3.1 then ans x=23.9 end code for this   c code for this formula x=(y-0.22z-072)4; where y=7.32 x=3.1 then ans x=23.9 can any one end code
jsp code
jsp code  what are the jsp code for view page in online journal
stegnography code
stegnography code  code for the digital stegnographic technique for the encryption and decryption of image
example code
example code  code for displaying a list from another class on a midlet
Code for a triangle.....
Code for a triangle.....   1 1 5 1 1 5 25 5 1 What is the source Code for above output
c code
c code  c code for this formula x=(y-0.22z-072)4; where y=7.32 x=3.1 then ans x=23.9 end code
JSF code
need jsf code that will populate combo box values from the database  Hi, i'm new on JSf,I need jsf code that will populate combo box values from the database when the form runs
Code for Pattern
Code for Pattern   * * * * * * * * Please write the code of above program and please do not use in this string tokennizer, string buffer etc i mean to say that please use very simple method
 

 

 

DMCA.com