on 02-06-2009 5:24 AM
Hi
Iam creating an application in web dynpro.In that labels "From Date" and "To Date" labels are present.
In that i created Context of type "Date".
I written code like this.
Date date=new Date();
java.sql.Date today=new java.sql.Date(date.getTime());
wdContext.currentTimelogElement().setFromDate(today);
wdContext.currentTimelogElement().setToDate(today);
While writing like this,its showing todayDate as "From Date " and "To Date ".
I want both the Dates should be different.
Suppose "From Date-06/02/2009" "To Date---10/02/2009" or
From Date-01/02/2009" "To Date---06/02/2009"
For that what are the modifications i have to do in the Code.
Regards
Sushma
tx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sushma,
your code
Date date=new Date();
java.sql.Date today=new java.sql.Date(date.getTime());
wdContext.currentTimelogElement().setFromDate(today);
wdContext.currentTimelogElement().setToDate(today);
new code
1. No need to use getTime as you want to display the date.
2. To hard code the dates
Date fromDate = new Date("10/25/2008"); // date in format : mm/dd/yyyy
Date toDate = new Date("01/05/2009"); // date in format : mm/dd/yyyy
Regards
Chander Kararia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
IF you want both the dates in different format create 2 contex variables and bind them to a simple type of type date with the format you want.
Bind these 2 context varibales to the fromDate and ToDate
Regards,
Padma N
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi..
If you want the different dates, create two value attributes of the type date and bind it to the 2 input field FROM and TO... It will diplay the calender. so that u can select the different dates.
No need to write any coding..
If u want to display the current date in the FROM field you can use this coding..
java.util.Date ud = new java.util.Date();
java.sql.Date sd = new java.sql.Date(ud.getDate());
sd.setYear(ud.getYear());
sd.setDate(ud.getDate());
sd.setMonth(ud.getMonth());
wdThis.currentContextElement().setFromdate(sd);
Here Fromdate is the value attribute of the type date.
Regards,
Alamelu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sushma,
Create 2 Date instances for 'FromDate' & 'ToDate' with required values & set them.
Example:
java.sql.Date fromDate = new java.sql.Date(109, 1, 1); // This is 1st Feb, 2009
wdContext.currentTimelogElement().setFromDate(fromDate);
Similarly, java.sql.Date toDate = new java.sql.Date(109, 1, 6); // This is 6th Feb, 2009
wdContext.currentTimelogElement().setToDate(toDate);
For details, refer http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Date.html
Hope this answers your query.
Kind Regards,
Nitin
Edited by: Nitin Jain on Feb 6, 2009 6:41 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You are setting the todays date for both the context fromdate and todate. You can set whatever dates you want like
wdcontext.curentcontext.setfromdate("Yourdate");
Hope this helps.
Regards,
Prasanthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I have taken UI Element "Input Field ".In that i had takenit of type "Date".
So in the layout for inputfield the calendar will be displayed.
Iam hardcoding the Values.I written code like that which i posted.
MY question is the "From Date" and "To date" must be hardcoded with different dates.
Regards
Sushma
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.