Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

how to set current date in timestamp attribute in Java Plain API

I create a timestamp attribute in task workitem.
Now I want to set current date in timestamp attribute in Java Plain API.
How to program it? have examples?

0 votes



One answer

Permanent link
A timestamp Attribute, if you look at the API e.g. IWorkItem.setDueDate() id of type java.sql.Timestamp.
You can use the PDE to look at that type, you can search in search engines how it is used. It boils down to
			Timestamp ts=new Timestamp(new Date().getTime());
			target.setDueDate(ts);

where Date is java.util.Date. There are a few constructors not deprecated, that you can use.

0 votes

Comments

Thanks for your advice.
I search for the SDK. I used the following code. It's ok.

//set now to date
        long now= System.currentTimeMillis();
IAttribute targetdate= workItemCommon.findAttribute(newState.getProjectArea(), "updatedate", monitor);
newState.setValue(targetdate, new Timestamp(now));
By the way, what is the PDE? Could you kindly tell me?How to use it?

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Nov 26 '13, 7:47 a.m.

Question was seen: 9,395 times

Last updated: Nov 27 '13, 2:38 a.m.

Confirmation Cancel Confirm