on 07-20-2006 2:36 PM
Hi,
I am having a Date Input field( binded to Data type). On load, i would like to display the current system date filled in that input field.
How do i achieve this ?
Reg/Venkat
Hi
Ignore my previous post. Better you have to use the following code. Create one attribute type is Date. Then bind into Input filed. Then inside DOint() use the following code.
java.util.Date tempDate = Calendar.getInstance().getTime();
Date sqlDate = new Date(tempDate.getTime());
wdContext.currentContextElement().setDateva(sqlDate);
Kind Regards,
S.Saravanan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venkatesan,
In your view in your init() method add the following code:
wdContext.currentContextElement().setOrderDate(new Date(System.currentTimeMillis()));
this is if your Date-attribute is in the root of the context.
else you have to set the date in the node where the date-attribute is present with:
IYOURNODEElement node = wdContext.createYOURNODEElement();
node.setOrderDate(new Date(System.currentTimeMillis()));
regards,
Björn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Assuming that you context attribute assigned to Date inputfield is Date.
Use following code:
Date dt = new Date(System.currentTimeMillis());
wdContext.currentContextElement().setDate(dt);
This will set the date to current date.
Regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the wdDoInit() method, use this code:
Let's assume that you have a context attribute CurrDate of type date and it is bound to your inputfield.
long currentTime = System.currentTimeMillis();
wdContext.currentContextElement().setCurrDate(new java.sql.Date(currentTime - (currentTime % 86400000)));
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
java.util.Date tempDate = Calendar.getInstance().getTime();
Date sqlDate = new Date(tempDate.getTime());
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
sdf.setTimeZone(TimeZone.getDefault());
String xx=sdf.format(cal.getTime());
then convert into Date and bind into Variable.
Kind Regards,
S.Saravanan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.