on 04-17-2006 11:56 PM
I'm trying to display an attribute of a PCD object - the "LastChangedAt" date/time from a System Landscape object. The value returns as a String, in the format "1134681210082". How can I convert that number into a Date?
Thanx,
Dale
Hi Dale,
Try this..
Date createdDate = new Date(Long.parseLong(result.getAttribute("com.sap.portal.pcd.gl.LastChangedAt")));
You can format this date again in whatever format you want.
like this..
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss ");
Date createdDate = new Date(Long.parseLong(result.getAttribute("com.sap.portal.pcd.gl.LastChangedAt")));
String createdAt = simpleDateFormat.format(createdDate);
Hope it helps.
Regards,
Karthick K Eswaran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanx! I also found that I was importing Date from HTMLB instead of java.util, so I was getting an error on formatting the output. But all is well now - thanx again.
Dale
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I believe the system stores date as Milliseconds from Jan 1 1970 in the form of a string. So try
Date myDate = new Date( new Long( <Date Value> ).longValue());
Hope this works ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.