on 09-15-2010 1:58 PM
Hi Friends,
I have one small doubt in WDJ,
inPut.setP_Budat();
above attribute is for input date field and the data type is java.sql.date data type.
Now I want to make the date default to systems date.that date looks like (dd.MM.yyyy) foramat
How can I do this.
Regards
Vijay K
Hi ,
use the below code
inPut.setP_Budat(new Date(System.currentTimeMillis()) , will set system date
Regards
Sunitha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Friend,
By using this code i am able to Print Sysdate.
DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
java.util.Date today = new java.util.Date();
java.sql.Date sqlToday = new java.sql.Date(today.getTime());
inPut.setP_Budat(sqlToday);
Now my Req is i am able to System date by default in date input filed. How can I do this.
Regards
Vijay K
Hi,
Try this:
1. Create an Input field in the View under a Transparent Container.
2. Navigate to Dictionaries>Simple Type>right-click "Create new Simple Type"
3. Enter the name and package for the simple type & select the bulit in type as "Date"
4. Switch to "Representation" tab and enter the format as dd.MM.yyyy
5. In the Context Tab, right-click create context attribute
6. Select type as the simple tyoe created in step 3.
7. Bind the Input field's "Vaue" property to the context attribute.
In the wdDoInit() write the following code:
wdContext.currentContextElement().set<contextattributename>(new java.sql.Date(System.currentTimeMillis());
This will load the current date.
Regards,
Poojith MV
Hi Poojith,
I have one more doubt. how to get last 2days back date.
for Example. I have to two input date fields. i.e From and TO date files. TO Date file must have today date(it comes automatically) From Date filed must 2days Back Date.
EX: From date Having 19.09.2010 and To date Having Today System Date(21.09.2010)
How to do this. Please tell me.
Regards
Vijay
Hi,
You can use the following code to get the two days previous date.
import java.util.Calendar;
...
Calendar currCal = Calendar.getInstance();
currCal.add(Calendar.DATE,-2);
Date date = new Date(currCal.getTimeInMillis());// Set this date to your From date field attribute.
...
Hope it helps.
Regards,
Manoj
Edited by: Manoj on Sep 21, 2010 10:47 AM
Hello Vijay,
You can use the Calende class for getting the current date and also to manipulate the dates that is 2 days before or after. There are many methods in the class which will help you to do so. Please refer to java docs of the calender class for the details of the methods.
http://download.oracle.com/javase/1.5.0/docs/api/java/util/Calendar.html
Regards,
Raju Bonagiri
>
> Hi Friends,
>
> I have one small doubt in WDJ,
>
> inPut.setP_Budat();
>
>
> above attribute is for input date field and the data type is java.sql.date data type.
> Now I want to make the date default to systems date.that date looks like (dd.MM.yyyy) foramat
> How can I do this.
>
> Regards
> Vijay K
Hi
Make a simple type and select date as built in type for it and then in the representation tab enter format as dd.MM.yyyy
it will solve the issue
Thanks
Sarbjeet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.