Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to convert long int date to Date datatype

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

replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question