code_fish
code_fish

Reputation: 3428

AS400 java api to get Last used date

I am using AS400 java api to get Last used date.

ObjectList ol = new ObjectList(_system,"QSYS", objectName,"*USRPRF");
ol.addObjectAttributeToRetrieve(ObjectDescription.LAST_USED_DATE);
Enumeration _objectEnum = ol.getObjects();
while (_objectEnum != null && _objectEnum.hasMoreElements()) {
    ObjectDescription od = (ObjectDescription) _objectEnum.nextElement();
    String name = od.getName();
    String lastUsedDateValue = od.getValue(ObjectDescription.LAST_USED_DATE)).toString();
}

In this code if last used date is blank then i got "Thu Aug 23 12:03:06 IST 1928" this type of date. Can any one tell where i am going wrong or what is the default system date and time on AS400 machine.

Upvotes: 1

Views: 130

Answers (1)

Loris Securo
Loris Securo

Reputation: 7638

The documentation of ObjectDescription.LAST_USED_DATE specify that

This field will contain a Date value of 0 ms if the object has no last-used date.

In teory you should get a string representing January 1, 1970, 00:00:00 GMT, so I'm not sure why you get that date. But you could call getTime() from the Date object to check if it really return 0 milliseconds.

Upvotes: 1

Related Questions