cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Current Date in webdynpro java

Private_Member_52584
Participant
0 Kudos

Hi Experts,

In my project i have two date input fields called

1)Start Date

2)End Date

and one Absence type input field is there. The user wants to set the start Date ,End date and absence type.

How to get the user set values in my project.i.e how to get the user inputs and the started date must be current date of the system and end date must be after the 3 months.

Can any body send code regarding this.

Thanks in advance.

Regards,

Venkat.

Edited by: Venkat5939 on Jan 11, 2011 4:46 PM

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Use the blow code to get todays date and date after 3 months

	  Date date = new Date(System.currentTimeMillis());
	  wdContext.currentContextElement().setTodaysDate(date);
	  Calendar calendar = Calendar.getInstance();
	  calendar.add(Calendar.MONTH,3);
	  wdContext.currentContextElement().setDateAfter3Months(new Date(calendar.getTimeInMillis()));

Regards,

Amol

former_member185879
Active Contributor
0 Kudos

Hello Venkat,

Current Date:

Date date = new Date(System.currentTimeMillis());

For getting the date after three months refer the following threads:

Hope it helps.

Regards

Nizamudeen SM

former_member218672
Active Contributor
0 Kudos

Hi VEnkat,

DateFormat df = new SimpleDateFormat("MM/dd/yyyy");

Date today = Calendar.getInstance().getTime();

String reportDate = df.format(today);

wdContext.currentContextElement().setFromDate(reportDate);

java.util.Date nextdate = DateHelper.addDays(reportDate, 90);

wdContext.currentContextElement().setToDate(nextdate);

Try this code

Regards,

Sen

Former Member
0 Kudos

Hi Venkat,

Below code gives the current date. .

Date date = new Date()

use the formatter to format the date as per your requirement.

Regards

Deepak