cancel
Showing results for 
Search instead for 
Did you mean: 

auto date setup

Former Member
0 Kudos

Hi, I would like to have "date" field filled with todays date automatically after starting the application? Is there a simple way to do that? Regards, Balmer

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Balmer,



wdDoInit()
{
  wdContext.currentContextElement().setDateElement( new  Date(System.currentTimeMillis()));
}

Regards

- Vinod

*

Edited by: Vinod V on Mar 18, 2008 3:10 PM

Former Member
0 Kudos

Thank you all for help

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

If you have a context attribute which is bound to the date field in the UI, then you can write this code in the wdDoInit():

//Let's say the context attribute is called "dateVal". Note that it should be of type java.sql.Date
wdContext.currentContextElement().setDateVal(new Date(System.currentTimeMillis()));

Regards,

Satyajit.

former_member197348
Active Contributor
0 Kudos

Hi Balmer,

//You can get current date 
Date currDate = new Date(System.currentTimeMillis());
//You can set your context like this:
wdContext.currentContextElement().set<attribname>(currDate);

regards,

Siva

Former Member
0 Kudos

Hi ,

Create attribute of type currDate. Then bind into Input filed. Then inside init() method :

java.util.Date tempDate = Calendar.getInstance().getTime();

Date sqlDate = new Date(tempDate.getTime());

wdContext.currentContextElement().setcurrDate(sqlDate);

Thanks,

Sunitha Hari